From 52f34e0baf8140599bd7b65a767f050cf85193bc Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Fri, 5 Feb 2010 19:16:51 +0000 Subject: [PATCH] Improving the PanZoomBar behavior so that when you click on the bar after dragging to the top, the map doesn't re-zoom on mouse up. r=me (closes #1861) git-svn-id: http://svn.openlayers.org/trunk/openlayers@10025 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Control/PanZoomBar.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/OpenLayers/Control/PanZoomBar.js b/lib/OpenLayers/Control/PanZoomBar.js index 3222a86630..9326234ff2 100644 --- a/lib/OpenLayers/Control/PanZoomBar.js +++ b/lib/OpenLayers/Control/PanZoomBar.js @@ -65,6 +65,18 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, { */ forceFixedZoomLevel: false, + /** + * Property: mouseDragStart + * {} + */ + mouseDragStart: null, + + /** + * Property: zoomStart + * {} + */ + zoomStart: null, + /** * Constructor: OpenLayers.Control.PanZoomBar */ @@ -85,6 +97,9 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, { }); OpenLayers.Control.PanZoom.prototype.destroy.apply(this, arguments); + + delete this.mouseDragStart; + delete this.zoomStart; }, /** @@ -342,7 +357,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, { if (!OpenLayers.Event.isLeftClick(evt)) { return; } - if (this.zoomStart) { + if (this.mouseDragStart) { this.div.style.cursor=""; this.map.events.un({ "mouseup": this.passEventToSlider, @@ -359,7 +374,6 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, { zoomLevel += Math.round(deltaY/this.zoomStopHeight); } this.map.zoomTo(zoomLevel); - this.moveZoomBar(); this.mouseDragStart = null; OpenLayers.Event.stop(evt); }