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:
johnd0e
2020-05-04 14:24:08 +03:00
committed by GitHub
parent e7a5c6ffbf
commit ec35ab52f6

View File

@ -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();