diff --git a/src/layer/tile/GridLayer.js b/src/layer/tile/GridLayer.js index d98994f3..7b4a04b7 100644 --- a/src/layer/tile/GridLayer.js +++ b/src/layer/tile/GridLayer.js @@ -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(); } diff --git a/src/map/anim/Map.ZoomAnimation.js b/src/map/anim/Map.ZoomAnimation.js index 085b2663..501b94d9 100644 --- a/src/map/anim/Map.ZoomAnimation.js +++ b/src/map/anim/Map.ZoomAnimation.js @@ -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 }); }, diff --git a/src/map/handler/Map.TouchZoom.js b/src/map/handler/Map.TouchZoom.js index bb4ae01c..e8b3754c 100644 --- a/src/map/handler/Map.TouchZoom.js +++ b/src/map/handler/Map.TouchZoom.js @@ -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 () {