<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Slider in Layerlist - how to fix glitchy transition when dragging in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/slider-in-layerlist-how-to-fix-glitchy-transition/m-p/1699863#M88404</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/358954"&gt;@BrandonPrice1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I looked at this some more this morning.&amp;nbsp; Try modifying your event listener on the Slider to only respond to when the event.state === "stop".&amp;nbsp; I think this should help as the minScale will only change when the user has finished moving the slider and not continuously as its dragged.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;    // 3. Robustly watch for slider value changes
    // To this for better performance:
    scaleSlider.on("thumb-drag", (event) =&amp;gt; {
      if (event.state === "stop" &amp;amp;&amp;amp; item.layer) {
        item.layer.minScale = event.value;
      }
    });&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 04 May 2026 15:09:23 GMT</pubDate>
    <dc:creator>Sage_Wall</dc:creator>
    <dc:date>2026-05-04T15:09:23Z</dc:date>
    <item>
      <title>Slider in Layerlist - how to fix glitchy transition when dragging</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/slider-in-layerlist-how-to-fix-glitchy-transition/m-p/1699656#M88400</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a slider for scale visibility on one of my layers in the layer list. When the layerlist has the slider only with no legend it doesn't glitch when dragged. For some reason, the glitch starts when the legend is added. Is there any way to resolve this?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BrandonPrice1_0-1777666509927.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/151863i292A82C4D4D087E9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="BrandonPrice1_0-1777666509927.png" alt="BrandonPrice1_0-1777666509927.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;async function defineActions(event) {
  const item = event.item;
  await item.layer.when();

  if (item.title === "Parcels") {
    // 1. Create the Slider specifically for Parcels
    const scaleSlider = new Slider({
      min: 0,
      max: 35000,
      values: [item.layer.minScale],
	  steps: 2000,
  	  precision: 0, 
      visibleElements: { labels: true, rangeLabels: true },
      container: document.createElement("div") // Best practice for custom panel content
    });

    // 2. Set the panel to ONLY the slider
    item.panel = {
      content: scaleSlider,
      open: false,
      title: "Scale Settings"
    };

      // 3. Robustly watch for slider value changes
    // To this for better performance:
scaleSlider.on("thumb-drag", (event) =&amp;gt; {
  item.layer.minScale = event.value;
});

  } else {
    // 4. Default behavior: Show legend for all other layers
    item.panel = {
      content: "legend",
      open: true
    };
  }

  // 5. Add custom actions separately
  if (item.title === "Land Use Type (Assessor Use Codes)") {
    item.actionsSections = [[
      {
        title: "Toggle Labels",
        className: "esri-icon-labels",
        id: "toggle-labels",
        type: "button"
      }
    ]];
  }
}
	


    const layerList = new LayerList({
  view: view,
  container: layersContainerDiv,
  visibilityAppearance: "checkbox",
  // Define the function directly within the constructor
  listItemCreatedFunction: defineActions,
  visible: false
});

// Listen for the action trigger
layerList.on("trigger-action", (event) =&amp;gt; {
  const id = event.action.id;
  const layer = event.item.layer;

  if (id === "toggle-labels") {
    // Toggle the labelsVisible property
    layer.labelsVisible = !layer.labelsVisible;
  }
});

view.ui.add(layersDiv, "top-right");&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 01 May 2026 20:18:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/slider-in-layerlist-how-to-fix-glitchy-transition/m-p/1699656#M88400</guid>
      <dc:creator>BrandonPrice1</dc:creator>
      <dc:date>2026-05-01T20:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: Slider in Layerlist - how to fix glitchy transition when dragging</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/slider-in-layerlist-how-to-fix-glitchy-transition/m-p/1699682#M88401</link>
      <description>&lt;P&gt;My first thought is that this is the result of the Legend's &lt;A href="https://developers.arcgis.com/javascript/latest/references/core/widgets/Legend/#respectLayerVisibility" target="_self"&gt;respectLayerVisibility&lt;/A&gt; property watching the scale values as the slider changes the minScale.&amp;nbsp; I'd need to create repro app to know for sure.&lt;/P&gt;&lt;P&gt;You might try using a &lt;A href="https://developers.arcgis.com/calcite-design-system/components/slider/" target="_self"&gt;calcite-slider&lt;/A&gt;&amp;nbsp;instead of the Slider widget.&amp;nbsp; The Calcite Slider has a&amp;nbsp;&lt;A href="https://developers.arcgis.com/calcite-design-system/components/slider/#api-reference-events-calciteSliderChange" target="_self"&gt;calciteSliderChange&lt;/A&gt;&amp;nbsp;event that only fires when the components handle is released and not continuously on drag as I think the Slider widget does.&amp;nbsp; Instead of creating a new &lt;A href="https://developers.arcgis.com/javascript/latest/references/core/widgets/Slider/" target="_self"&gt;Slider&lt;/A&gt; instance you would need to use const scaleSlider = document.createElement("calcite-slider") then set the appropriate properties.&amp;nbsp; I'm not certain this is the issue and fix but it's probably worth a try.&amp;nbsp; Another way to test this would be to create a new Legend instance instead of using the "legend" keyword and setting the &lt;A href="https://developers.arcgis.com/javascript/latest/references/core/widgets/Legend/#layerInfos" target="_self"&gt;layerInfos&lt;/A&gt; property to be the item.layer and respectLayerVisibility to false.&amp;nbsp; I can try and look at this more closely next week, it's late on a Friday &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2026 22:16:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/slider-in-layerlist-how-to-fix-glitchy-transition/m-p/1699682#M88401</guid>
      <dc:creator>Sage_Wall</dc:creator>
      <dc:date>2026-05-01T22:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Slider in Layerlist - how to fix glitchy transition when dragging</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/slider-in-layerlist-how-to-fix-glitchy-transition/m-p/1699863#M88404</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/358954"&gt;@BrandonPrice1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I looked at this some more this morning.&amp;nbsp; Try modifying your event listener on the Slider to only respond to when the event.state === "stop".&amp;nbsp; I think this should help as the minScale will only change when the user has finished moving the slider and not continuously as its dragged.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;    // 3. Robustly watch for slider value changes
    // To this for better performance:
    scaleSlider.on("thumb-drag", (event) =&amp;gt; {
      if (event.state === "stop" &amp;amp;&amp;amp; item.layer) {
        item.layer.minScale = event.value;
      }
    });&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 04 May 2026 15:09:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/slider-in-layerlist-how-to-fix-glitchy-transition/m-p/1699863#M88404</guid>
      <dc:creator>Sage_Wall</dc:creator>
      <dc:date>2026-05-04T15:09:23Z</dc:date>
    </item>
  </channel>
</rss>

