Register change listeners for loading tiles only
With this commit we register a change listener at a time when we are guaranteed that the listener will be called. In this was we don't need to remove listeners when the tile is dropped from the tile queue. And to avoid busy-polling between IDLE and LOADING we rely on the map to call requestRenderFrame when new tiles change to LOADING from IDLE.
This commit is contained in:
@@ -391,10 +391,11 @@ ol.renderer.webgl.TileLayer.prototype.renderFrame =
|
||||
|
||||
tileState = tile.getState();
|
||||
if (tileState == ol.TileState.IDLE) {
|
||||
this.listenToTileChange(tile);
|
||||
this.updateWantedTiles(frameState.wantedTiles, tileSource, tileCoord);
|
||||
tileCenter = tileGrid.getTileCoordCenter(tileCoord);
|
||||
frameState.tileQueue.enqueue(tile, tileSourceKey, tileCenter);
|
||||
} else if (tileState == ol.TileState.LOADING) {
|
||||
this.listenToTileChange(tile);
|
||||
} else if (tileState == ol.TileState.LOADED) {
|
||||
if (mapRenderer.isTileTextureLoaded(tile)) {
|
||||
tilesToDrawByZ[z][tileCoord.toString()] = tile;
|
||||
|
||||
Reference in New Issue
Block a user