Many 'postrender' and 'rendercomplete' events for a single VectorTile layer loading

1.8k views Asked by At

We added a new layer VectorTile with a style function to a PluggableMap (OpenLayers v6.4.3)

According to the doc:

  • layer 'postrender' event is triggered after a layer is rendered
  • map 'rendercomplete' event is triggered when rendering is complete, i.e. all sources and tiles have finished loading for the current viewport, and all tiles are faded in.

By logging those events in the console when loading this map (single VectorTile layer) we can see 6 layer 'postrender' events and 3 map 'rendercomplete' events.

It seems a layer 'postrender' event is fired after each rendered tile (from renderer/canvas/VectorTileLayer) of the layer and a map 'rendercomplete' is fired every 2 rendered tiles.

How to detect when the layer is fully rendered, i.e. all tiles rendered?

1

There are 1 answers

4
MoonE On

The map should be completely rendered when the first rendercomplete event occurs.

I created a PR that should fix the duplicate rendercomplete events you observed. https://github.com/openlayers/openlayers/pull/11859