Create and remove layer renderers in renderFrame
Previously, the map renderer would listen for layers being added and removed from the layers collection, and would create and remove layer renderers in response to these events. With this change, layer renderers are only created or removed when renderFrame is called, which leads to somewhat simpler code. We still need to listen to changes to the layers collection, but now these only trigger a new render. This new approach also has an advantage when layers change order. Swapping the order of two layers involves removing one and re-inserting it elsewhere. With the old approach, this would cause the deletion and re-creation of the layer renderer. With this new approach, the layer renderer is preserved.
This commit is contained in:
@@ -641,4 +641,6 @@ ol.renderer.webgl.Map.prototype.renderFrame = function(frameState) {
|
||||
frameState.animate = true;
|
||||
}
|
||||
|
||||
this.removeUnusedLayerRenderers(frameState);
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user