Don't repeatedly render while waiting for tiles to load

Instead of going into an unnecessary animation loop, we can simply wait to be notified when tiles load.

The WebGL renderer still sets frameState.animate true, but I think this too should be unnecessary (full page example works without it, side-by-side example shows it cannot yet be removed).
This commit is contained in:
Tim Schaub
2013-02-06 16:10:46 -07:00
parent 2bd29ff60e
commit e079c19413
4 changed files with 21 additions and 8 deletions

View File

@@ -131,6 +131,8 @@ ol.renderer.dom.TileLayer.prototype.renderFrame =
tileState = tile.getState();
if (tileState == ol.TileState.IDLE) {
goog.events.listen(tile, goog.events.EventType.CHANGE,
this.handleTileChange, false, this);
this.updateWantedTiles(frameState.wantedTiles, tileSource, tileCoord);
tileCenter = tileGrid.getTileCoordCenter(tileCoord);
frameState.tileQueue.enqueue(tile, tileSourceKey, tileCenter);
@@ -233,10 +235,6 @@ ol.renderer.dom.TileLayer.prototype.renderFrame =
this.renderedVisible_ = true;
}
if (!allTilesLoaded) {
frameState.animate = true;
}
this.updateUsedTiles(frameState.usedTiles, tileSource, z, tileRange);
this.scheduleExpireCache(frameState, tileSource);