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:
@@ -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_();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user