New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CanvasVectorLayerRenderer sets canvas width to zero on every render #12791
Comments
Good find! The idea was to zero the size and not touch it again until the layer is made visible again. If it really gets resized twice on every render, we need to fix something. |
I just tried this. Are you talking about openlayers/src/ol/renderer/canvas/VectorLayer.js Lines 259 to 261 in 79a54e3
|
Ok, I see what you mean. Interestingly, I can only reproduce this in your codesandbox. When I run the exact same code locally, it does not happen. Can you reproduce that locally? Anyway, I created #12792, which should fix this issue. Can you please try with that branch and see if you notice any irregularities there? |
Yep, the issue could be reproduced locally too. I just tested #12792 and seems like it fixes the issue! I didn't notice any visible regressions either when there are other layers than the |
Describe the bug
When an empty
VectorLayer
is followed by other layers, the combined canvas is resized tocanvas.width=0
on every render after which the width is restored. This seems to negatively affect performance compared to clearing the canvas withCanvasRenderingContext2D.clearRect
, which is used in other renderers (CanvasTileLayerRenderer
,CanvasImageLayerRenderer
).To Reproduce
Reproduction example at https://t1d1e.csb.app/, sources https://codesandbox.io/s/great-sky-t1d1e.
Expected behavior
CanvasVectorLayerRenderer
should probably useclearRect
to clear the canvas instead of clearing it by setting the canvas ' width to zero.The text was updated successfully, but these errors were encountered: