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
This commit is contained in:
follower
2006-06-15 17:26:39 +00:00
parent 239f542783
commit 084a3e6989

View File

@@ -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