Dear users,
in my application I use the LayerList Widget and an Expand-Div to place "hard-coded" legend-images:
const layerList = new LayerList({
view: view
});
const expandbutton = new Expand({
view: view,
content: "Legende<br>(aktuell kein Layer aktiviert)",
label: "Legende",
id: "legendendings",
expandTooltip:"Legende",
expanded:false,
container: document.createElement("div")
});
E.G. if the users has actived the layer "climate" a hard-coded image like "climatelegend.png" has to be placed in the legend-container.
I wonder now: How can I find out which layer of the LayerList is activated?
If I open the legend-Expand I would like to have that information.
I tried things like:
reactiveUtils.watch(
() => [expandbutton.expanded], ([expandbutton]) => {
alert ("hello: "+layerList.selectedItems.layer);
});...but so far I don`t get the layer-name?