From 9c50bb5c01475bed7f19f42d7a2453c3f86dcaf8 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Fri, 16 Dec 2011 11:22:31 +0100 Subject: [PATCH] Don't set the new lonlat if the new zoom is not valid. This avoids unwanted panning without zooming when using the mousewheel to zoom out on a wrapDateLine map (see #109). --- lib/OpenLayers/Map.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index adf2fc25d1..45a21a57e6 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -1749,7 +1749,12 @@ OpenLayers.Map = OpenLayers.Class({ } } if (this.baseLayer.wrapDateLine) { + var requestedZoom = zoom; zoom = this.adjustZoom(zoom); + if (zoom !== requestedZoom) { + // zoom was adjusted, so keep old lonlat to avoid panning + lonlat = this.getCenter(); + } } // dragging is false by default var dragging = options.dragging || this.dragging;