Let's trap all these events. Tested by bitner on IRC in IE (thanks!) and works

in FF on Mac. Hopefully this works! this is my major blocker for RC2, a 
few more minor changes and i'll kick it out.


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1314 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-08-19 15:01:58 +00:00
parent 8e51ada8de
commit d500981f09

View File

@@ -120,15 +120,16 @@ OpenLayers.Control.LayerSwitcher.prototype =
inputElem.value = layer.name;
inputElem.checked = checked;
inputElem.layer = layer;
inputElem.control = this;
Event.observe(inputElem, "mouseup",
this.onInputClick.bindAsEventListener(inputElem));
// create span
var labelSpan = document.createElement("span");
labelSpan.innerHTML = layer.name;
labelSpan.style.verticalAlign = (baseLayer) ? "bottom" : "auto";
Event.observe(labelSpan,
"click",
this.onLabelClick.bindAsEventListener(inputElem));
Event.observe(labelSpan, "click",
this.onInputClick.bindAsEventListener(inputElem));
// create line break
var br = document.createElement("br");
@@ -158,11 +159,14 @@ OpenLayers.Control.LayerSwitcher.prototype =
*
* @param {Event} e
*/
onLabelClick: function(e) {
onInputClick: function(e) {
var clickedRadioButton = ((this.type == "radio") && (this.checked));
if (!clickedRadioButton) {
this.checked = !this.checked;
}
Event.stop(e);
this.control.updateMap();
},
/** Need to update the map accordingly whenever user clicks in either of
@@ -270,9 +274,11 @@ OpenLayers.Control.LayerSwitcher.prototype =
this.div.style.backgroundColor = "transparent";
Event.observe(this.div, "mouseup",
this.mouseUp.bindAsEventListener(this));
this.ignoreEvent);
Event.observe(this.div, "click",
this.ignoreEvent);
Event.observe(this.div, "mousedown",
this.mouseDown.bindAsEventListener(this));
this.ignoreEvent);
Event.observe(this.div, "dblclick", this.ignoreEvent);
@@ -301,8 +307,9 @@ OpenLayers.Control.LayerSwitcher.prototype =
this.baseLayersDiv = document.createElement("div");
this.baseLayersDiv.style.paddingLeft = "10px";
Event.observe(this.baseLayersDiv, "click",
/*Event.observe(this.baseLayersDiv, "click",
this.onLayerClick.bindAsEventListener(this));
*/
this.layersDiv.appendChild(this.baseLayersDiv);
@@ -315,8 +322,9 @@ OpenLayers.Control.LayerSwitcher.prototype =
this.dataLayersDiv = document.createElement("div");
this.dataLayersDiv.style.paddingLeft = "10px";
Event.observe(this.dataLayersDiv, "click",
/*Event.observe(this.dataLayersDiv, "click",
this.onLayerClick.bindAsEventListener(this));
*/
this.layersDiv.appendChild(this.dataLayersDiv);
this.div.appendChild(this.layersDiv);