Unregister tile change listeners
When the tile queue loads a tile it registers a "change" listener on that tile. But currently that listener is not unregistered, unless the tile cache containing that tile fills up and "dipose" is called on that tile. This commit makes handleTileChange deregister the "change" listener on the tile, if the tile is now in "loaded" state.
This commit is contained in:
@@ -76,6 +76,8 @@ ol.TileQueue.prototype.handleTileChange = function(event) {
|
||||
var state = tile.getState();
|
||||
if (state === ol.TileState.LOADED || state === ol.TileState.ERROR ||
|
||||
state === ol.TileState.EMPTY) {
|
||||
goog.events.unlisten(tile, goog.events.EventType.CHANGE,
|
||||
this.handleTileChange, false, this);
|
||||
--this.tilesLoading_;
|
||||
this.tileChangeCallback_();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user