[OpenLayers-Users] LayerSwitcher Event.observe on div - safe to remove?

Matthew Doyle mtd at bom.gov.au
Tue Nov 18 20:09:40 EST 2008


Hi OL Users,

I am overriding some functionality in the LayerSwitcher class. My main
changes are that the LayerSwitcher now appears outside of the map area in a
separate div, and that i have changed the baseLayer input element from radio
buttons to a select box.

All was working fine in FF2/FF3/IE7, but I discovered that Chrome and Safari
were not responding to any clicks on the select box. I spotted the culprit
in loadContents(): (line 481-487 in original LayerSwitcher.js)


OpenLayers.Event.observe(this.div, "mouseup", 
            OpenLayers.Function.bindAsEventListener(this.mouseUp, this));
OpenLayers.Event.observe(this.div, "click",
                      this.ignoreEvent);
OpenLayers.Event.observe(this.div, "mousedown",
            OpenLayers.Function.bindAsEventListener(this.mouseDown, this));
OpenLayers.Event.observe(this.div, "dblclick", this.ignoreEvent);


When i comment these lines out, my solution works across all browsers.
Is it safe for me to remove this code? Are these events needed in any other
way for the LayerSwitcher to behave properly?

I assume this was put in place to ignore any click events which happened
below the default style of the LayerSwitcher which appears over the map.

(I am using 2.6. I found 2.7 to be a little slow for me on some of the older
browsers we support, hence the delay in moving to it.)

cheers and many thanks in advance,
Matt
-- 
View this message in context: http://www.nabble.com/LayerSwitcher-Event.observe-on-div---safe-to-remove--tp20571978p20571978.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list