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) {
var tiles = this._levels[zoom].tiles,
tile = tiles[key];
_removeTile: function (key) {
var coords = this._keyToTileCoords(key),
level = this._levels[coords.z],
tiles = level && level.tiles,
tile = tiles && tiles[key];
if (tile) {
L.DomUtil.remove(tile);
delete tiles[key];
this.fire('tileunload', {tile: tile});
this.fire('tileunload', {
tile: tile,
coords: coords
});
}
},
_initTile: function (tile) {