<?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: Restore zooming after manual disable in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/restore-zooming-after-manual-disable/m-p/1266834#M80514</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/193359"&gt;@GregoryBologna&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;A simpler approach may be to set constraints on the maximum and minimum zoom values in the view. Then you wouldn't have to worry about the event handlers. A codepen that shows how to do this can be found here:&amp;nbsp;&lt;A href="https://codepen.io/sagewall/pen/bGxaOpw" target="_blank"&gt;https://codepen.io/sagewall/pen/bGxaOpw&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;     require(["esri/Map", "esri/views/MapView"], (Map, MapView) =&amp;gt; {
      const map = new Map({
        basemap: "topo-vector"
      });
      const view = new MapView({
        container: "viewDiv",
        map: map,
        zoom: 10,
        center: [15, 65]
      });
      view.when(() =&amp;gt; {
        const zoomContainer = document.getElementById("zoomContainer");
        const zoomSwitch = document.getElementById("zoomSwitch");
        view.ui.add(zoomContainer, "top-right");
        zoomSwitch.addEventListener("calciteSwitchChange", (event) =&amp;gt; {
          if (event.target.checked) {
            disableZoom();
          } else {
            enableZoom();
          }
        })
      })
      const disableZoom = () =&amp;gt; {
        view.constraints.minZoom = view.zoom;
        view.constraints.maxZoom = view.zoom;
        view.ui.components = ["attribution"]
      }
      const enableZoom = () =&amp;gt; {
        view.constraints = {};
        view.ui.components = ["attribution", "zoom"]
      }
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 11 Mar 2023 15:15:40 GMT</pubDate>
    <dc:creator>Sage_Wall</dc:creator>
    <dc:date>2023-03-11T15:15:40Z</dc:date>
    <item>
      <title>Restore zooming after manual disable</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/restore-zooming-after-manual-disable/m-p/1266090#M80502</link>
      <description>&lt;P&gt;I found this code to disable zoom. Any idea how restore or undo disable zooming, including removing the stepPropagation event? I checked the events in Chrome dev tools event listeners, but couldn't find it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function disableZooming() {
  
  // Removes the zoom action on the popup
  view.popup.actions = [];

  // stops propagation of default behavior when an event fires
  function stopEvtPropagation(event) {
	event.stopPropagation();
  }

  // exlude the zoom widget from the default UI
  view.ui.components = ["attribution"];

  // disable mouse wheel scroll zooming on the view
  view.on("mouse-wheel", stopEvtPropagation);

  // disable zooming via double-click on the view
  view.on("double-click", stopEvtPropagation);

  // disable zooming out via double-click + Control on the view
  view.on("double-click", ["Control"], stopEvtPropagation);

  // disables pinch-zoom and panning on the view
  view.on("drag", stopEvtPropagation);

  // disable the view's zoom box to prevent the Shift + drag
  // and Shift + Control + drag zoom gestures.
  view.on("drag", ["Shift"], stopEvtPropagation);
  view.on("drag", ["Shift", "Control"], stopEvtPropagation);

  // prevents zooming with the + and - keys
  view.on("key-down", (event) =&amp;gt; {
	const prohibitedKeys = ["+", "-", "Shift", "_", "=", "ArrowUp", "ArrowDown", "ArrowRight", "ArrowLeft"];
	const keyPressed = event.key;
	if (prohibitedKeys.indexOf(keyPressed) !== -1) {
	  event.stopPropagation();
	}
  });
  
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 17:36:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/restore-zooming-after-manual-disable/m-p/1266090#M80502</guid>
      <dc:creator>GregoryBologna</dc:creator>
      <dc:date>2023-03-09T17:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: Restore zooming after manual disable</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/restore-zooming-after-manual-disable/m-p/1266834#M80514</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/193359"&gt;@GregoryBologna&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;A simpler approach may be to set constraints on the maximum and minimum zoom values in the view. Then you wouldn't have to worry about the event handlers. A codepen that shows how to do this can be found here:&amp;nbsp;&lt;A href="https://codepen.io/sagewall/pen/bGxaOpw" target="_blank"&gt;https://codepen.io/sagewall/pen/bGxaOpw&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;     require(["esri/Map", "esri/views/MapView"], (Map, MapView) =&amp;gt; {
      const map = new Map({
        basemap: "topo-vector"
      });
      const view = new MapView({
        container: "viewDiv",
        map: map,
        zoom: 10,
        center: [15, 65]
      });
      view.when(() =&amp;gt; {
        const zoomContainer = document.getElementById("zoomContainer");
        const zoomSwitch = document.getElementById("zoomSwitch");
        view.ui.add(zoomContainer, "top-right");
        zoomSwitch.addEventListener("calciteSwitchChange", (event) =&amp;gt; {
          if (event.target.checked) {
            disableZoom();
          } else {
            enableZoom();
          }
        })
      })
      const disableZoom = () =&amp;gt; {
        view.constraints.minZoom = view.zoom;
        view.constraints.maxZoom = view.zoom;
        view.ui.components = ["attribution"]
      }
      const enableZoom = () =&amp;gt; {
        view.constraints = {};
        view.ui.components = ["attribution", "zoom"]
      }
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Mar 2023 15:15:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/restore-zooming-after-manual-disable/m-p/1266834#M80514</guid>
      <dc:creator>Sage_Wall</dc:creator>
      <dc:date>2023-03-11T15:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: Restore zooming after manual disable</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/restore-zooming-after-manual-disable/m-p/1267066#M80531</link>
      <description>&lt;P&gt;I was at first worried the mouse and keyboard would still zoom with constraints, but now I am using it and it works just right. Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2023 14:40:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/restore-zooming-after-manual-disable/m-p/1267066#M80531</guid>
      <dc:creator>GregoryBologna</dc:creator>
      <dc:date>2023-03-13T14:40:59Z</dc:date>
    </item>
  </channel>
</rss>

