Add hook points to allow for a proper NoGap plugin (#5476)

This commit is contained in:
Iván Sánchez Ortega 2017-04-27 15:38:55 +02:00 committed by GitHub
parent bd7cf8a265
commit b19893c9ba

View File

@ -322,7 +322,11 @@ export var GridLayer = Layer.extend({
if (fade < 1) {
nextFrame = true;
} else {
if (tile.active) { willPrune = true; }
if (tile.active) {
willPrune = true;
} else {
this._onOpaqueTile(tile);
}
tile.active = true;
}
}
@ -335,6 +339,8 @@ export var GridLayer = Layer.extend({
}
},
_onOpaqueTile: Util.falseFn,
_initContainer: function () {
if (this._container) { return; }
@ -358,9 +364,11 @@ export var GridLayer = Layer.extend({
for (var z in this._levels) {
if (this._levels[z].el.children.length || z === zoom) {
this._levels[z].el.style.zIndex = maxZoom - Math.abs(zoom - z);
this._onUpdateLevel(z);
} else {
DomUtil.remove(this._levels[z].el);
this._removeTilesAtZoom(z);
this._onRemoveLevel(z);
delete this._levels[z];
}
}
@ -381,6 +389,8 @@ export var GridLayer = Layer.extend({
// force the browser to consider the newly added element for transition
Util.falseFn(level.el.offsetWidth);
this._onCreateLevel(level);
}
this._level = level;
@ -388,6 +398,12 @@ export var GridLayer = Layer.extend({
return level;
},
_onUpdateLevel: Util.falseFn,
_onRemoveLevel: Util.falseFn,
_onCreateLevel: Util.falseFn,
_pruneTiles: function () {
if (!this._map) {
return;
@ -442,6 +458,7 @@ export var GridLayer = Layer.extend({
_invalidateAll: function () {
for (var z in this._levels) {
DomUtil.remove(this._levels[z].el);
this._onRemoveLevel(z);
delete this._levels[z];
}
this._removeAllTiles();