Ask questionsWebGLPointsLayer does not update dimensions when browser viewport dimensions change.

Describe the bug When the canvas (context?) re-sizes (eg. resize browser window) the WebGL layer does not resize. The result is that in some cases the rendered view can be very pixellated, as if a tiny context is being upscaled by a lot.

To Reproduce

  1. Go to
  2. Scale your browser window ZOOM down to like 10% (Ctrl -).
  3. Refresh the page, which renders the canvas context at that zoom level
  4. Zoom back to 100%
  5. Notice the blue circles are very low resolution

Expected behavior Changes in viewport size should cause an update to the WebGL layer's size.

Thoughts I am guessing that the opposite might also be true: when zooming down to 10% you end up with a positively colossal WebGL frame size. I think the above demo is simplistic enough, but when I apply the same workflow to my own, more complex app, Zooming out basically crashes the browser.


Answer questions ablakey

Thanks for the response. You're right, it happens on canvas layers too. I missed it because silly me, the layer in question was nice square polygons that scale really well without jagged edges.

I imagine that the act of changing the viewport size (and pixel ratio) is not likely to be a common one. One remedy is to wire into that happening (MutationObserver?) and just destroy and rebuild the Map when necessary. This is probably something the developer, not the library, can worry about.


Related questions

Memory leak in Openlayers 6 beta hot 1
Click event on specific layer issue in OpenLayers 5 hot 1
Ol3 with mbtiles hot 1
Canvas elements not garbage collected on iOS 12 hot 1
Github User Rank List