I'm trying to have a legend which changes depending on the current layer visible, but can't figure out how to get layer selection events so that I can then check which layer is selected in order to change the legend.
Is there any way to do this? I've tried adding an EventListener, but can't get that to work. I'm wondering if there are any built-in ways to do what I'm trying to do.
I'm trying to have a legend which changes depending on the current layer visible, but can't figure out how to get layer selection events so that I can then check which layer is selected in order to change the legend.
Is there any way to do this? I've tried adding an EventListener, but can't get that to work. I'm wondering if there are any built-in ways to do what I'm trying to do.