mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-07-23 00:34:55 +00:00
GridLayer: fix _updateLevels and _removeTilesAtZoom (#7123)
Because of particular quality of `for ... in` loop, type of `z` is 'string'. Thus condition `z === zoom` never met in _updateLevels. Considering wrong arg type, _removeTilesAtZoom also never had any action. Cleaner solution would be to iterate `Object.keys()` instead, but it is available only since IE 9.
This commit is contained in:
@ -365,6 +365,7 @@ export var GridLayer = Layer.extend({
|
||||
if (zoom === undefined) { return undefined; }
|
||||
|
||||
for (var z in this._levels) {
|
||||
z = Number(z);
|
||||
if (this._levels[z].el.children.length || z === zoom) {
|
||||
this._levels[z].el.style.zIndex = maxZoom - Math.abs(zoom - z);
|
||||
this._onUpdateLevel(z);
|
||||
@ -461,7 +462,7 @@ export var GridLayer = Layer.extend({
|
||||
_invalidateAll: function () {
|
||||
for (var z in this._levels) {
|
||||
DomUtil.remove(this._levels[z].el);
|
||||
this._onRemoveLevel(z);
|
||||
this._onRemoveLevel(Number(z));
|
||||
delete this._levels[z];
|
||||
}
|
||||
this._removeAllTiles();
|
||||
|
Reference in New Issue
Block a user