Merge pull request #2423 from fredj/dispose

Dispose the tiles removed from the cache
This commit is contained in:
Frédéric Junod
2014-07-28 17:18:27 +02:00
2 changed files with 3 additions and 2 deletions

View File

@@ -330,6 +330,7 @@ ol.Map = function(options) {
* @private
*/
this.viewportSizeMonitor_ = new goog.dom.ViewportSizeMonitor();
this.registerDisposable(this.viewportSizeMonitor_);
goog.events.listen(this.viewportSizeMonitor_, goog.events.EventType.RESIZE,
this.updateSize, false, this);

View File

@@ -48,7 +48,7 @@ ol.TileCache.prototype.expireCache = function(usedTiles) {
if (zKey in usedTiles && usedTiles[zKey].contains(tile.tileCoord)) {
break;
} else {
this.pop();
this.pop().dispose();
}
}
};
@@ -64,7 +64,7 @@ ol.TileCache.prototype.pruneTileRange = function(tileRange) {
while (i--) {
key = this.peekLastKey();
if (tileRange.contains(ol.TileCoord.createFromString(key))) {
this.pop();
this.pop().dispose();
} else {
this.get(key);
}