Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140584

How to get canvas from postcompose event of map in openlayers 6

$
0
0

we are using openlayers and in version 5.3 we were using this construction:

map.once('postcompose', async(event) => {
  let canvas = event.context.canvas;
  // doing something with canvas
}

But in openLayers 6.0 the argument context is undefined for event (which of course broke our application).

I read here that:

Layers are no longer composed to a single Canvas element. Instead, they are added to the map viewport as individual elements.

So how do I get the canvas of a single layer?

I also read here that:

Canvas context. Not available when the event is dispatched by the map. Only available when a Canvas renderer is used, null otherwise.

Is it somehow possible to set canvas renderer to all the layers so that CanvasRenderingContext2D is not undefined for the 'postcompose'event?

Thanks for any tips, Gal


Viewing all articles
Browse latest Browse all 140584

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>