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:
@@ -147,9 +147,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
|||||||
backdropLabel.layer = layer;
|
backdropLabel.layer = layer;
|
||||||
|
|
||||||
// set event handlers
|
// set event handlers
|
||||||
backdropLabelOuter.onclick = this.ignoreEvent.bindAsEventListener(this);
|
this._setEventHandlers(backdropLabel);
|
||||||
backdropLabelOuter.ondblclick = this.ignoreEvent.bindAsEventListener(this);
|
|
||||||
backdropLabelOuter.onmousedown = this.singleClick.bindAsEventListener(this);
|
|
||||||
|
|
||||||
// add label to div
|
// add label to div
|
||||||
backdropLabelOuter.appendChild(backdropLabel);
|
backdropLabelOuter.appendChild(backdropLabel);
|
||||||
@@ -167,7 +165,19 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
|||||||
this.setTabActivation(backdropLabel, layer.getVisibility());
|
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
|
* @private
|
||||||
|
|||||||
Reference in New Issue
Block a user