Issue with Layer Panel Color Update on Movement

262
0
12-04-2023 09:18 PM
mukecz1
New Contributor II

Hello,

I have a function that detects if a layer has a definitionExpression and then changes the color of the layer panel. It's working fine, except when I move the layer panels. Although I can see in the console that it gets the correct element, it does not update the color of the element.

I feel that when I move it, it creates another ID for the component and then changes it back after I finish moving.

   reactiveUtils.watch(
        () => layerList.operationalItems.map(item => item.layer),
        (layers) => {
          layers.map(layer => {
            if (!excludedTitles.includes(layer.title) && layer["definitionExpression"]) {
              const layerIdParts = layer.id?.split("-layer-");
              const layerBaseId = layerIdParts ? layerIdParts[0] : '';
              if (!layerBaseId) return;
              const selector = `[data-layer-uid*="${layerBaseId}-object-"]`;
              const layerListElement = document.querySelector(selector);
              if (!layerListElement) return;
              layerListElement.classList['add']("filter-list-panel");
            }
          });
        }
    );

Thanks

Tags (1)
0 Kudos
0 Replies