LayerList event when layer visibility is changed

Idea created by Dschontzler_pulsiam on May 1, 2019
    New
    Score30
    • Dschontzler_pulsiam
    • glennerion
    • agilvarry@utah.gov_uplan

    Please add an event to the LayerList widget so we can listen for changes to layer visibility. For example, in our applications, we want to save the layer configuration whenever something changes. We expected that the LayerList would notify us of changes to layer visibility, but that is currently not the case.

     

    I expect it would look something like so:

    const list = new LayerList({ view });

    list.on('layer-visibility', (layer) => {
      if (layer.visible) doSomething();
      else doSomethingElse();
    });