more flexible tile remove method

This commit is contained in:
Vladimir Agafonkin 2014-03-20 17:18:58 -07:00
parent 683cc4534c
commit 9b752757ef

View File

@ -390,13 +390,22 @@ L.GridLayer = L.Layer.extend({
} }
}, },
_removeTile: function (key, zoom) { _removeTile: function (key) {
var tiles = this._levels[zoom].tiles, var coords = this._keyToTileCoords(key),
tile = tiles[key]; level = this._levels[coords.z],
tiles = level && level.tiles,
tile = tiles && tiles[key];
L.DomUtil.remove(tile); if (tile) {
delete tiles[key]; L.DomUtil.remove(tile);
this.fire('tileunload', {tile: tile});
delete tiles[key];
this.fire('tileunload', {
tile: tile,
coords: coords
});
}
}, },
_initTile: function (tile) { _initTile: function (tile) {