Remove tiles that are still loading at alt z

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.
This commit is contained in:
Tim Schaub
2012-09-27 17:44:12 +02:00
parent 9536ba8e14
commit 981a40a994

View File

@@ -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
*/
@@ -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_();
}
/**