<?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: ArcGIS JS Api - Getting information on the drawn shape while preventing moving in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-getting-information-on-the-drawn/m-p/1126791#M75621</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/546199"&gt;@Aeseir&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;&lt;P&gt;It seems that you're wanting to disable the rotation on update of the graphic that was drawn via the Sketch widget so that you can create your own &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#hitTest" target="_self"&gt;hitTest&lt;/A&gt;&amp;nbsp;to access that graphic information. You can disable rotation by setting the following &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html" target="_self"&gt;SketchViewModel&lt;/A&gt; properties to "false":&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#updateOnGraphicClick" target="_self"&gt;updateOnGraphicClick&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#defaultUpdateOptions" target="_self"&gt;defaultUpdateOptions&lt;/A&gt;.enableRotation&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#defaultUpdateOptions" target="_self"&gt;defaultUpdateOptions&lt;/A&gt;.toggleToolOnClick&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Then create a hitTest on the view so that you can access the graphic that was drawn:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;    view.on("click", (event) =&amp;gt; {
        // only include graphics from graphics layer in the hitTest
        const opts = {
          include: graphicsLayer
        }
        view.hitTest(event, opts).then((response) =&amp;gt; {
          // check if a feature is returned from the graphicslayer
          if (response.results.length) {
            const graphic = response.results[0].graphic;
            // do something with the graphic
            console.log(graphic);
          }
        });
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check out this sample I put together that combines the above:&amp;nbsp;&lt;A href="https://codepen.io/laurenb14/pen/GRMmKMo?editors=1000" target="_blank"&gt;https://codepen.io/laurenb14/pen/GRMmKMo?editors=1000&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This doesn't disable the rotation on the graphic creation but disables it for any updates. Hope this helps!&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Lauren&lt;/P&gt;</description>
    <pubDate>Thu, 16 Dec 2021 17:21:24 GMT</pubDate>
    <dc:creator>LaurenBoyd</dc:creator>
    <dc:date>2021-12-16T17:21:24Z</dc:date>
    <item>
      <title>ArcGIS JS Api - Getting information on the drawn shape while preventing moving</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-getting-information-on-the-drawn/m-p/1126543#M75609</link>
      <description>&lt;P&gt;I am trying to find out how a user can draw a shape, and on click get the information on the shape they drew, without transforming and moving it around.&lt;/P&gt;&lt;P&gt;I've managed to get sketch up and running and drawing working.&lt;/P&gt;&lt;P&gt;However even disabling all the options when user clicks on it it still allows moving of shape, and i don't know how to get details of the shape (particularly points of the shape so i can store it for future drawing).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what i have so far&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;graphicsLayer&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;GraphicsLayer&lt;/SPAN&gt;&lt;SPAN&gt;();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;webmap&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;WebMap&lt;/SPAN&gt;&lt;SPAN&gt;({&lt;/SPAN&gt;&lt;/DIV&gt;// committed for brevity&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;layers&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; [&lt;/SPAN&gt;&lt;SPAN&gt;graphicsLayer&lt;/SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; });&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;const&lt;/SPAN&gt; &lt;SPAN&gt;view&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;MapView&lt;/SPAN&gt;&lt;SPAN&gt;({&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;map&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;webmap&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// committed for brevity&lt;/SPAN&gt;&lt;/DIV&gt;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gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;enableRotation&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;false&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;enableScaling&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;false&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;enableZ&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;false&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;toggleToolOnClick&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;false&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; });&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 16 Dec 2021 03:02:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-getting-information-on-the-drawn/m-p/1126543#M75609</guid>
      <dc:creator>Aeseir</dc:creator>
      <dc:date>2021-12-16T03:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS JS Api - Getting information on the drawn shape while preventing moving</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-getting-information-on-the-drawn/m-p/1126791#M75621</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/546199"&gt;@Aeseir&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;&lt;P&gt;It seems that you're wanting to disable the rotation on update of the graphic that was drawn via the Sketch widget so that you can create your own &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#hitTest" target="_self"&gt;hitTest&lt;/A&gt;&amp;nbsp;to access that graphic information. You can disable rotation by setting the following &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html" target="_self"&gt;SketchViewModel&lt;/A&gt; properties to "false":&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#updateOnGraphicClick" target="_self"&gt;updateOnGraphicClick&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#defaultUpdateOptions" target="_self"&gt;defaultUpdateOptions&lt;/A&gt;.enableRotation&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#defaultUpdateOptions" target="_self"&gt;defaultUpdateOptions&lt;/A&gt;.toggleToolOnClick&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Then create a hitTest on the view so that you can access the graphic that was drawn:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;    view.on("click", (event) =&amp;gt; {
        // only include graphics from graphics layer in the hitTest
        const opts = {
          include: graphicsLayer
        }
        view.hitTest(event, opts).then((response) =&amp;gt; {
          // check if a feature is returned from the graphicslayer
          if (response.results.length) {
            const graphic = response.results[0].graphic;
            // do something with the graphic
            console.log(graphic);
          }
        });
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check out this sample I put together that combines the above:&amp;nbsp;&lt;A href="https://codepen.io/laurenb14/pen/GRMmKMo?editors=1000" target="_blank"&gt;https://codepen.io/laurenb14/pen/GRMmKMo?editors=1000&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This doesn't disable the rotation on the graphic creation but disables it for any updates. Hope this helps!&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Lauren&lt;/P&gt;</description>
      <pubDate>Thu, 16 Dec 2021 17:21:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-getting-information-on-the-drawn/m-p/1126791#M75621</guid>
      <dc:creator>LaurenBoyd</dc:creator>
      <dc:date>2021-12-16T17:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS JS Api - Getting information on the drawn shape while preventing moving</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-getting-information-on-the-drawn/m-p/1127040#M75626</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/400217"&gt;@LaurenBoyd&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the additional insights.&amp;nbsp; I was able to replicate the hit mechanism after digging a bit deeper into event documentation so that has been nailed, thanks for reinforcing the finding.&lt;/P&gt;&lt;P&gt;The remainder problem is that user can still move the shape after they have drawn it, how do i prevent them moving the shape. In your example is the same issue, i can draw the shape and still drag it around the map.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have previously disabled scaling, rotation, transformation and toolOnClick as you can see.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Dec 2021 02:30:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-getting-information-on-the-drawn/m-p/1127040#M75626</guid>
      <dc:creator>Aeseir</dc:creator>
      <dc:date>2021-12-17T02:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS JS Api - Getting information on the drawn shape while preventing moving</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-getting-information-on-the-drawn/m-p/1129214#M75722</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/546199"&gt;@Aeseir&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thanks for elaborating on what you are trying to achieve! It seems that you may want to set the&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#defaultUpdateOptions" target="_self"&gt;SketchViewModel's defaultUpdateOptions tool parameter&lt;/A&gt; to null. This should disable any update functionality since there is no tool to update graphics.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;sketchVM.defaultUpdateOptions.tool = null;&lt;/LI-CODE&gt;&lt;P&gt;I added this in my code and it no longer allows updates:&amp;nbsp;&lt;A href="https://codepen.io/laurenb14/pen/GRMmKMo?editors=1000" target="_blank"&gt;https://codepen.io/laurenb14/pen/GRMmKMo?editors=1000&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Lauren&lt;/P&gt;</description>
      <pubDate>Tue, 28 Dec 2021 17:45:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-api-getting-information-on-the-drawn/m-p/1129214#M75722</guid>
      <dc:creator>LaurenBoyd</dc:creator>
      <dc:date>2021-12-28T17:45:18Z</dc:date>
    </item>
  </channel>
</rss>

