Skip to content

Commit

Permalink
Remove tiles that are still loading at alt z
Browse files Browse the repository at this point in the history
When zooming to a new zoom level, we can immediately remove tiles from the previous level.  This (strongly) suggests not adding images to the container until they have actually loaded.
  • Loading branch information
tschaub committed Sep 27, 2012
1 parent 9536ba8 commit 981a40a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/ol/renderer/dom/tilelayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,19 @@ ol.renderer.dom.TileLayer.prototype.handleTileChange_ = function(event) {
};


/**
* Remove all loading tiles that have been appended.
* @private
*/
ol.renderer.dom.TileLayer.prototype.removeLoadingTiles_ = function() {
for (var key in this.loadingTiles_) {
var tile = this.loadingTiles_[key];
goog.dom.removeNode(tile.getImage(this));
delete this.loadingTiles_[key];
}
};


/**
* @inheritDoc
*/
Expand All @@ -175,7 +188,7 @@ ol.renderer.dom.TileLayer.prototype.render = function() {

if (z != this.renderedZ_) {
// no longer wait for previously loading tiles
this.loadingTiles_ = {};
this.removeLoadingTiles_();
}

/**
Expand Down

0 comments on commit 981a40a

Please sign in to comment.