diff --git a/lib/OpenLayers/Control/PanZoomBar.js b/lib/OpenLayers/Control/PanZoomBar.js index a083553311..7efb1d8eb1 100644 --- a/lib/OpenLayers/Control/PanZoomBar.js +++ b/lib/OpenLayers/Control/PanZoomBar.js @@ -109,11 +109,19 @@ OpenLayers.Control.PanZoomBar.prototype = Event.stop(evt); }, zoomBarDown:function(evt) { + this.map.events.register("mousemove", this, this.mapMouseDrag); + this.map.events.register("mouseup", this, this.mapMouseUp); this.mouseDragStart = evt.xy.copyOf(); this.zoomStart = evt.xy.copyOf(); this.div.style.cursor = "move"; Event.stop(evt); }, + mapMouseDrag:function(evt) { + this.sliderEvents.handleBrowserEvent(evt); + }, + mapMouseUp:function(evt) { + this.sliderEvents.handleBrowserEvent(evt); + }, zoomBarDivDrag: function(evt) { this.sliderEvents.handleBrowserEvent(evt); }, @@ -127,6 +135,8 @@ OpenLayers.Control.PanZoomBar.prototype = }, zoomBarUp:function(evt) { this.div.style.cursor="default"; + this.map.events.remove("mousemove"); + this.map.events.remove("mouseup"); var deltaY = this.zoomStart.y - evt.xy.y this.map.zoomTo(this.map.zoom + Math.round(deltaY/this.zoomStopHeight)); this.moveZoomBar(); diff --git a/lib/OpenLayers/Events.js b/lib/OpenLayers/Events.js index ca5fc4fb30..28f268c944 100644 --- a/lib/OpenLayers/Events.js +++ b/lib/OpenLayers/Events.js @@ -59,6 +59,10 @@ OpenLayers.Events.prototype = { var listeners = this.listeners[type]; listeners.push( func.bindAsEventListener(obj) ); }, + + remove: function(type) { + this.listeners[type].pop(); + }, /** * @param {event} evt