<?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 Move Polygon  by centroid in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/move-polygon-by-centroid/m-p/414113#M38115</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a easy way to move a polygon by its centroid on js API 4.x? I'm trying to implement a function where the user can drag a polygon of a graphicslayer on the screen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Oct 2017 13:15:04 GMT</pubDate>
    <dc:creator>RodrigoFelga</dc:creator>
    <dc:date>2017-10-20T13:15:04Z</dc:date>
    <item>
      <title>Move Polygon  by centroid</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/move-polygon-by-centroid/m-p/414113#M38115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a easy way to move a polygon by its centroid on js API 4.x? I'm trying to implement a function where the user can drag a polygon of a graphicslayer on the screen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Oct 2017 13:15:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/move-polygon-by-centroid/m-p/414113#M38115</guid>
      <dc:creator>RodrigoFelga</dc:creator>
      <dc:date>2017-10-20T13:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: Move Polygon  by centroid</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/move-polygon-by-centroid/m-p/414114#M38116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There's no built-in way to do this. &amp;nbsp;In general, you need to clone a graphic, change the&amp;nbsp;geometry on the clone, add clone to the layer, and then remove the old graphic. &amp;nbsp;You can't just change the geometry. &amp;nbsp;This will hopefully change&amp;nbsp;in the future.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In terms of how you'd implement this,&amp;nbsp;I would approach this by&amp;nbsp;determining the difference in X and Y between&amp;nbsp;"the handle" ie the centroid in your case, but possibly&amp;nbsp;any point inside the polygon, and the current location of the mouse. &amp;nbsp;Then you'll want to translate every vertex in every ring of the polygon by that amount in X and Y. &amp;nbsp;I'll see if I can put together a simple example of this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Oct 2017 14:17:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/move-polygon-by-centroid/m-p/414114#M38116</guid>
      <dc:creator>ThomasSolow</dc:creator>
      <dc:date>2017-10-20T14:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: Move Polygon  by centroid</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/move-polygon-by-centroid/m-p/414115#M38117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's a sample showing how you might allow points, polylines, and polygons to be dragged. &amp;nbsp;In this example I'm using wherever the user clicked inside the polygon as the handle. &amp;nbsp;You could easily use&amp;nbsp;the centroid of the polygon as the origin/handle&amp;nbsp;if you like:&amp;nbsp;&lt;A class="link-titled" href="https://codepen.io/solowt/pen/QqoaeK?editors=1000#0" title="https://codepen.io/solowt/pen/QqoaeK?editors=1000#0"&gt;https://codepen.io/solowt/pen/QqoaeK?editors=1000#0&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Oct 2017 14:52:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/move-polygon-by-centroid/m-p/414115#M38117</guid>
      <dc:creator>ThomasSolow</dc:creator>
      <dc:date>2017-10-20T14:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Move Polygon  by centroid</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/move-polygon-by-centroid/m-p/414116#M38118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's exact what I need, thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Oct 2017 15:13:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/move-polygon-by-centroid/m-p/414116#M38118</guid>
      <dc:creator>RodrigoFelga</dc:creator>
      <dc:date>2017-10-20T15:13:57Z</dc:date>
    </item>
  </channel>
</rss>

