[OpenLayers-Dev] Hiding Layers from the Layer Switcher
Peterson Eric-EEP002
Eric.Peterson at motorola.com
Wed Jul 18 17:21:45 EDT 2007
> The event you are talking about is the 'changelayer' event, on the Map
object. This event fires any time a layer is changed, and you can then
loop through the layers and call:
Okay, so I created a new function called updateLayerVisibility() which
walks through my list of tracks, then updates the line layer visibility
for each track to match the marker layer visibility for that track. I
then registered my event handler like so:
map.events.register ("changelayer", map, updateLayerVisibility);
I then run it in Firebug, set a breakpoint in updateLayerVisibility(),
and click my checkboxes in the LayerSwitcher. But the breakpoint is
never tripped ... The changelayer event is never being triggered.
I looked into the code a bit, and I think I may have found a bug in the
LayerSwitcher.js file (the latest trunk version has this issue as well
as 2.4). In the onInputClick() method, the 'changebaselayer' event is
being triggered when the base layer changes, but there's no
'changelayer' event when an overlay layer changes. Should there be the
following line between 284 and 285?
this.layer.map.events.triggerEvent("changelayer");
Just wondering ...
-eP
More information about the Dev
mailing list