Remove listeners when dropping tiles

This commit is contained in:
Éric Lemoine
2013-03-05 16:04:01 +01:00
parent 5b258ca23f
commit fd6aaff2f5
3 changed files with 39 additions and 4 deletions

View File

@@ -89,6 +89,8 @@ ol.TileQueue.prototype.dequeue_ = function() {
}
var tileKey = tile.getKey();
delete this.queuedTileKeys_[tileKey];
tile.inQueue--;
goog.asserts.assert(tile.inQueue >= 0);
return tile;
};
@@ -110,6 +112,8 @@ ol.TileQueue.prototype.enqueue = function(tile, tileSourceKey, tileCenter) {
this.heap_.push([priority, tile, tileSourceKey, tileCenter]);
this.queuedTileKeys_[tileKey] = true;
this.siftDown_(0, this.heap_.length - 1);
tile.inQueue++;
goog.asserts.assert(tile.inQueue > 0);
}
}
};
@@ -246,6 +250,11 @@ ol.TileQueue.prototype.reprioritize = function() {
if (priority == ol.TileQueue.DROP) {
tileKey = tile.getKey();
delete this.queuedTileKeys_[tileKey];
tile.inQueue--;
goog.asserts.assert(tile.inQueue >= 0);
if (tile.inQueue === 0) {
goog.events.removeAll(tile);
}
} else {
node[0] = priority;
heap[n++] = node;