diff --git a/lib/OpenLayers/Control/MouseToolbar.js b/lib/OpenLayers/Control/MouseToolbar.js index d7773e6f73..0c4b0481f8 100644 --- a/lib/OpenLayers/Control/MouseToolbar.js +++ b/lib/OpenLayers/Control/MouseToolbar.js @@ -62,10 +62,8 @@ OpenLayers.Control.MouseToolbar.prototype = btn.imgLocation = imgLocation; btn.activeImgLocation = activeImgLocation; - btn.events = new OpenLayers.Events(this, btn); + btn.events = new OpenLayers.Events(this, btn, null, true); btn.events.register("mousedown", this, this.buttonClick); - btn.events.register("mouseup", this, Event.stop); - btn.events.register("click", this, Event.stop); btn.action = id; btn.title = title; btn.alt = title; diff --git a/lib/OpenLayers/Control/PanZoomBar.js b/lib/OpenLayers/Control/PanZoomBar.js index 448c9b9c10..6706a37365 100644 --- a/lib/OpenLayers/Control/PanZoomBar.js +++ b/lib/OpenLayers/Control/PanZoomBar.js @@ -86,7 +86,7 @@ OpenLayers.Control.PanZoomBar.prototype = "absolute"); this.slider = slider; - this.sliderEvents = new OpenLayers.Events(this, slider); + this.sliderEvents = new OpenLayers.Events(this, slider, null, true); this.sliderEvents.register("mousedown", this, this.zoomBarDown); this.sliderEvents.register("mousemove", this, this.zoomBarDrag); this.sliderEvents.register("mouseup", this, this.zoomBarUp); @@ -116,7 +116,7 @@ OpenLayers.Control.PanZoomBar.prototype = this.zoombarDiv = div; - this.divEvents = new OpenLayers.Events(this, div); + this.divEvents = new OpenLayers.Events(this, div, null, true); this.divEvents.register("mousedown", this, this.divClick); this.divEvents.register("mousemove", this, this.passEventToSlider); this.divEvents.register("dblclick", this, this.doubleClick); diff --git a/lib/OpenLayers/Events.js b/lib/OpenLayers/Events.js index db979b4874..5212f2491b 100644 --- a/lib/OpenLayers/Events.js +++ b/lib/OpenLayers/Events.js @@ -37,11 +37,14 @@ OpenLayers.Events.prototype = { * is being added * @param {DOMElement} element A dom element to respond to browser events * @param {Array} eventTypes Array of custom application events + * @param {Boolean} fallThrough Allow events to fall through after these + * have been handled? */ - initialize: function (object, element, eventTypes) { + initialize: function (object, element, eventTypes, fallThrough) { this.object = object; this.element = element; this.eventTypes = eventTypes; + this.fallThrough = fallThrough; this.listeners = new Object(); // if eventTypes is specified, create a listeners list for each @@ -176,7 +179,9 @@ OpenLayers.Events.prototype = { } } // don't fall through to other DOM elements - Event.stop(evt); + if (!this.fallThrough) { + Event.stop(evt); + } } },