From 084a3e69891bb1c4c03596feb54c4699278f3483 Mon Sep 17 00:00:00 2001 From: follower Date: Thu, 15 Jun 2006 17:26:39 +0000 Subject: [PATCH] Extract the event handler setting functionality into its own method in preparation for our fix for #57. git-svn-id: http://svn.openlayers.org/trunk/openlayers@600 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Control/LayerSwitcher.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers/Control/LayerSwitcher.js b/lib/OpenLayers/Control/LayerSwitcher.js index 246ca86ded..6e1229167d 100644 --- a/lib/OpenLayers/Control/LayerSwitcher.js +++ b/lib/OpenLayers/Control/LayerSwitcher.js @@ -147,9 +147,7 @@ OpenLayers.Control.LayerSwitcher.prototype = backdropLabel.layer = layer; // set event handlers - backdropLabelOuter.onclick = this.ignoreEvent.bindAsEventListener(this); - backdropLabelOuter.ondblclick = this.ignoreEvent.bindAsEventListener(this); - backdropLabelOuter.onmousedown = this.singleClick.bindAsEventListener(this); + this._setEventHandlers(backdropLabel); // add label to div backdropLabelOuter.appendChild(backdropLabel); @@ -167,7 +165,19 @@ OpenLayers.Control.LayerSwitcher.prototype = this.setTabActivation(backdropLabel, layer.getVisibility()); }, + /* + @private + + @param {DOMElement} div + @param {Boolean} activate + */ + _setEventHandlers : function(element) { + // We only want to respond to a mousedown event. + element.onclick = this.ignoreEvent.bindAsEventListener(this); + element.ondblclick = this.ignoreEvent.bindAsEventListener(this); + element.onmousedown = this.singleClick.bindAsEventListener(this); + }, /** * @private