Only load tiles that are not yet loaded

This commit is contained in:
Alessandro Isaacs
2015-07-10 08:17:14 -07:00
parent a705c6fe11
commit b57cdb730c

View File

@@ -94,9 +94,11 @@ ol.TileQueue.prototype.loadMoreTiles = function(maxTotalLoading, maxNewLoads) {
var i, tile;
for (i = 0; i < newLoads; ++i) {
tile = /** @type {ol.Tile} */ (this.dequeue()[0]);
goog.events.listen(tile, goog.events.EventType.CHANGE,
this.handleTileChange, false, this);
tile.load();
if (tile.getState() === ol.TileState.IDLE) {
goog.events.listen(tile, goog.events.EventType.CHANGE,
this.handleTileChange, false, this);
tile.load();
++this.tilesLoading_;
}
}
this.tilesLoading_ += newLoads;
};