Skip to content

Instantly share code, notes, and snippets.

@mourner
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mourner/76121d64f958d4087d4b to your computer and use it in GitHub Desktop.
Save mourner/76121d64f958d4087d4b to your computer and use it in GitHub Desktop.
diff --git a/src/layer/tile/GridLayer.js b/src/layer/tile/GridLayer.js
index d98994f..596d47f 100644
--- a/src/layer/tile/GridLayer.js
+++ b/src/layer/tile/GridLayer.js
@@ -301,26 +301,29 @@ 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 (!noPrune) {
this._pruneTiles();
}
diff --git a/src/map/anim/Map.ZoomAnimation.js b/src/map/anim/Map.ZoomAnimation.js
index 085b266..501b94d 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 bb4ae01..e8b3754 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 () {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment