fix touch zoom regression
This commit is contained in:
parent
f27ead251a
commit
142e0661b1
@ -215,7 +215,9 @@ L.GridLayer = L.Layer.extend({
|
||||
level.zoom = zoom;
|
||||
|
||||
this._setZoomTransform(level, map.getCenter(), map.getZoom());
|
||||
L.Util.falseFn(level.el.offsetWidth); // Force recalculation to trigger transitions.
|
||||
|
||||
// force the browser to consider the newly added element for transition
|
||||
L.Util.falseFn(level.el.offsetWidth);
|
||||
}
|
||||
|
||||
this._level = level;
|
||||
@ -301,26 +303,31 @@ L.GridLayer = L.Layer.extend({
|
||||
},
|
||||
|
||||
_viewReset: function (e) {
|
||||
var map = this._map;
|
||||
this._reset(map.getCenter(), map.getZoom(), e && e.hard);
|
||||
this._reset(this._map.getCenter(), this._map.getZoom(), e && e.hard);
|
||||
},
|
||||
|
||||
_animateZoom: function (e) {
|
||||
this._reset(e.center, e.zoom, false, true);
|
||||
this._reset(e.center, e.zoom, false, true, e.noUpdate);
|
||||
},
|
||||
|
||||
_reset: function (center, zoom, hard, noPrune) {
|
||||
_reset: function (center, zoom, hard, noPrune, noUpdate) {
|
||||
var tileZoom = Math.round(zoom),
|
||||
tileZoomChanged = this._tileZoom !== tileZoom;
|
||||
|
||||
if (tileZoomChanged || hard) {
|
||||
if (!noUpdate && (hard || tileZoomChanged)) {
|
||||
|
||||
if (this._abortLoading) {
|
||||
this._abortLoading();
|
||||
}
|
||||
|
||||
this._tileZoom = tileZoom;
|
||||
this._updateLevels();
|
||||
this._resetGrid();
|
||||
this._update(center, tileZoom);
|
||||
|
||||
if (!L.Browser.mobileWebkit) {
|
||||
this._update(center, tileZoom);
|
||||
}
|
||||
|
||||
if (!noPrune) {
|
||||
this._pruneTiles();
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ L.Map.include(!zoomAnimated ? {} : {
|
||||
return true;
|
||||
},
|
||||
|
||||
_animateZoom: function (center, zoom, startAnim) {
|
||||
_animateZoom: function (center, zoom, startAnim, noUpdate) {
|
||||
if (startAnim) {
|
||||
this._animatingZoom = true;
|
||||
|
||||
@ -97,7 +97,8 @@ L.Map.include(!zoomAnimated ? {} : {
|
||||
zoom: zoom,
|
||||
scale: this.getZoomScale(zoom),
|
||||
origin: this.latLngToLayerPoint(center),
|
||||
offset: this._getCenterOffset(center).multiplyBy(-1)
|
||||
offset: this._getCenterOffset(center).multiplyBy(-1),
|
||||
noUpdate: noUpdate
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -84,7 +84,7 @@ L.Map.TouchZoom = L.Handler.extend({
|
||||
this._zoom = map.getScaleZoom(this._scale);
|
||||
|
||||
if (this._scale !== 1 || this._delta.x !== 0 || this._delta.y !== 0) {
|
||||
map._animateZoom(this._center, this._zoom);
|
||||
map._animateZoom(this._center, this._zoom, false, true);
|
||||
}
|
||||
},
|
||||
|
||||
@ -106,7 +106,7 @@ L.Map.TouchZoom = L.Handler.extend({
|
||||
zoomDelta = this._zoom - oldZoom,
|
||||
finalZoom = map._limitZoom(zoomDelta > 0 ? Math.ceil(this._zoom) : Math.floor(this._zoom));
|
||||
|
||||
map._animateZoom(this._center, finalZoom, true);
|
||||
map._animateZoom(this._center, finalZoom, true, true);
|
||||
},
|
||||
|
||||
_getTargetCenter: function () {
|
||||
|
Loading…
Reference in New Issue
Block a user