OpenLayers当前有2个示例,介绍了如何实现一层滑动:
经典瓷砖层: https://popenlayers.org/en/latest/exampless/ layer-swipe.html
webgltile层:
我需要使其适合N Tile和WebGltile层的混合。
将它们结合在一起时,当裁剪到比以前的农作物较小的区域时,似乎没有清除Webgltile层。此结果在上一部分图像的一部分中保持在下部的tileLayer之上:
gif
(请不要介意缺少的关键图像,只是为了显示行为,我确认了使用工作层的行为)。
繁殖:
从这个意义上讲,WebGltile层的行为与正常的瓷砖层的行为不同,即使单独删除也可以正确删除。
我尝试调用 gl.clear(gl.color_buffer_bit);
在“ prerender”回调中不是解决方案,因为它在其下方擦除了另一个WebGltile层,该层将在滑动的另一侧裁剪。
有人知道如何在不依赖层数,下层类型等的假设的情况下实施这种裁剪效果?
OpenLayers currently has 2 examples on how to implement a layer swipe:
Classic Tile layers: https://openlayers.org/en/latest/examples/layer-swipe.html
WebGLTile layers: https://openlayers.org/en/latest/examples/webgl-layer-swipe.html
I need to make it work for a mix of N Tile and WebGLTile layers.
When combining them, it seems like the WebGLTile layers are not cleared when cropped to a smaller area than the previous crop. This result in parts of the previous image to stay on top of a lower TileLayer:
GIF of the behavior
(Please don't mind the missing key image, it is just to show the behavior and I confirmed the same behavior with working layers).
Reproduction:
https://codesandbox.io/s/webgl-layer-swipe-broken-crrnvq?file=/main.js
In that sense, the WebGLTile layers are behaving differently than regular Tile layers that get erased properly even alone.
I tried calling gl.clear(gl.COLOR_BUFFER_BIT);
in the 'prerender' callback is not a solution because it erases another WebGLTile layer below it that would be cropped on the other side of the swipe.
Does someone know how to implement this cropping effect without relying on assumptions of the number of layers, the type of lower layers and so on?
发布评论