From 88ff0bc9afe1f5e8246e96516ef7db34199d94bf Mon Sep 17 00:00:00 2001 From: euzuro Date: Thu, 14 Sep 2006 20:25:23 +0000 Subject: [PATCH] give our events model the option of allowing events to fall through so that they can be picked up in lower layers. change the panzoombar and the mousetoolbar to use this new fallthrough option so that we aren't causing bugs when the drag zoom rectangle gets dropped over them, they dont freak out. next up i am going to re-fix the popup events code to use this feature. git-svn-id: http://svn.openlayers.org/trunk/openlayers@1468 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Control/MouseToolbar.js | 4 +--- lib/OpenLayers/Control/PanZoomBar.js | 4 ++-- lib/OpenLayers/Events.js | 9 +++++++-- 3 files changed, 10 insertions(+), 7 deletions(-) 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); + } } },