<?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: Draw class' &amp;quot;draw.create('rectangle')&amp;quot; doesn't draw rectangle in ArcGIS JS lib v4.7 and above in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/draw-class-quot-draw-create-rectangle-quot-doesn-t/m-p/29799#M2492</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it worked it is by chance because Draw.create did not support creation of rectangle, circle and ellipses until version 4.7.&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-2d-draw-SegmentDrawAction.html" title="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-2d-draw-SegmentDrawAction.html"&gt;SegmentDrawAction | API Reference | ArcGIS API for JavaScript 4.9&lt;/A&gt;&amp;nbsp; was introduced at 4.7. SegmentDrawAction supports creation of rectangles, squares, circles and ellipses so developer must decide what shapes they are creating based on vertices being returned from the events of this class.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 Nov 2018 15:58:40 GMT</pubDate>
    <dc:creator>UndralBatsukh</dc:creator>
    <dc:date>2018-11-15T15:58:40Z</dc:date>
    <item>
      <title>Draw class' "draw.create('rectangle')" doesn't draw rectangle in ArcGIS JS lib v4.7 and above</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/draw-class-quot-draw-create-rectangle-quot-doesn-t/m-p/29796#M2489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Hi everyone,&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;I have a problem with using the Draw&amp;nbsp;class for drawing a rectangle on the map after changing the ArcGIS JS lib version from 4.6 to anything higher.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Attached there is a file called "Draw_recangle_working_lib_v4.6.html", which contains a slightly modified version of the code from the official example (&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=draw-measure"&gt;&lt;SPAN class=""&gt;ArcGIS API for JavaScript Sandbox&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;) for how to use the "Draw"&amp;nbsp;class. There, using the lib version 4.6, the draw widget successfully is being used to draw a rectangle.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;The second file, "Draw_recangle_notworking_lib_v4.7.html", contains the exact same code except for the ArcGIS JS lib version that is used - there, v4.7 is included. Instead of drawing a rectangle, a line is being drawn. This is true for any lib version higher than 4.6.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Unfortunately, I did not find any official example of how to use the Draw&amp;nbsp;class&amp;nbsp;for drawing a rectangle (instead of a "polygon"). I also only found that from 4.6 to 4.7, there was a breaking change being introduced regarding the Draw&amp;nbsp;class&amp;nbsp;where the graphic property was removed from the "draw-complete" event. However, this property is not explicitly being used in the attached code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;I don't encounter similar problems when using this class for drawing polygons or points.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;So, my question is whether in order to use "draw.create('rectangle')", my code has to be adjusted since it is now supposed to work differently. One possibility would be to replace the Draw class with the SketchViewModel class but that would probably require larger effort than maybe adjusting the existing code a bit to make it work as expected again.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Best regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Christian&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2018 09:18:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/draw-class-quot-draw-create-rectangle-quot-doesn-t/m-p/29796#M2489</guid>
      <dc:creator>ChristianSchuetz</dc:creator>
      <dc:date>2018-11-12T09:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: Draw class' "draw.create('rectangle')" doesn't draw rectangle in ArcGIS JS lib v4.7 and above</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/draw-class-quot-draw-create-rectangle-quot-doesn-t/m-p/29797#M2490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I quickly looked at the attached code. The code would have never worked as long as you were trying to create rectangle.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would suggest you use SketchViewModel as the code will be much simpler as it creates the rectangle for you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are creating a rectangle using draw, you have to do the math to create the rectangle geometry. I created an app that creates a rectangle using Draw.create("rectangle"). But as you can see you as a developer are responsible for creating the geometry as user drags the mouse.&amp;nbsp; The test app probably needs lots of improvement but should give you an idea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/anon/pen/aQWzRb?&amp;amp;editors=100"&gt;Draw a rectangle app&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2018 21:29:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/draw-class-quot-draw-create-rectangle-quot-doesn-t/m-p/29797#M2490</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2018-11-14T21:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: Draw class' "draw.create('rectangle')" doesn't draw rectangle in ArcGIS JS lib v4.7 and above</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/draw-class-quot-draw-create-rectangle-quot-doesn-t/m-p/29798#M2491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you for your response and your time! I must admit I don't understand your second sentence about the code not working. The file "&lt;SPAN style="background-color: #ffffff;"&gt;Draw_recangle_working_lib_v4.6.html" should show that with lib version 4.6 the rectangle is being drawn as expected. For that, please click on the button in the upper right corner, then left-click on the map, and start drawing the rectangle.&amp;nbsp; I used similar code for the Draw class in our production application, and with version 4.6, this has worked, so far. Just increasing the version while using the otherwise unchanged code resulted in the rectangle not being drawn anymore.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Do the rest of your comment and your example code mean that this is the new way to draw rectangles with the Draw class from library version 4.7 onwards?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;By the way, I just downloaded my provided files, and somehow they are&amp;nbsp;different from when I tried them out before uploading them in the first place. Maybe this is what you meant by "not working code"? I uploaded them again, and hopefully this time, it will work.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;To be on the save side,&amp;nbsp;I also created two code-pen examples:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;v4.6:&amp;nbsp;&lt;A class="link-titled" href="https://codepen.io/anon/pen/jQmGXN?editors=1000" title="https://codepen.io/anon/pen/jQmGXN?editors=1000"&gt;Draw_recangle_working_lib_v4.6&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;v4.7:&amp;nbsp;&lt;A class="link-titled" href="https://codepen.io/anon/pen/rQmGbM?editors=1000" title="https://codepen.io/anon/pen/rQmGbM?editors=1000"&gt;Draw_recangle_notworking_lib_v4.7&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Christian&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2018 08:14:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/draw-class-quot-draw-create-rectangle-quot-doesn-t/m-p/29798#M2491</guid>
      <dc:creator>ChristianSchuetz</dc:creator>
      <dc:date>2018-11-15T08:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: Draw class' "draw.create('rectangle')" doesn't draw rectangle in ArcGIS JS lib v4.7 and above</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/draw-class-quot-draw-create-rectangle-quot-doesn-t/m-p/29799#M2492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it worked it is by chance because Draw.create did not support creation of rectangle, circle and ellipses until version 4.7.&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-2d-draw-SegmentDrawAction.html" title="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-2d-draw-SegmentDrawAction.html"&gt;SegmentDrawAction | API Reference | ArcGIS API for JavaScript 4.9&lt;/A&gt;&amp;nbsp; was introduced at 4.7. SegmentDrawAction supports creation of rectangles, squares, circles and ellipses so developer must decide what shapes they are creating based on vertices being returned from the events of this class.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Nov 2018 15:58:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/draw-class-quot-draw-create-rectangle-quot-doesn-t/m-p/29799#M2492</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2018-11-15T15:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: Draw class' "draw.create('rectangle')" doesn't draw rectangle in ArcGIS JS lib v4.7 and above</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/draw-class-quot-draw-create-rectangle-quot-doesn-t/m-p/29800#M2493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Christian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good Afternoon!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please refer the following Codepen link, which &lt;STRONG&gt;implements the modified workaround to draw the “Rectangle” geometry, &lt;/STRONG&gt;in the sample application "Measure while drawing":&lt;/P&gt;&lt;UL style="margin-top: 0in;"&gt;&lt;LI&gt;&lt;A href="https://urldefense.proofpoint.com/v2/url?u=https-3A__codepen.io_anon_pen_YRBXOo-3Feditors-3D1000&amp;amp;d=DwMGaQ&amp;amp;c=n6-cguzQvX_tUIrZOS_4Og&amp;amp;r=77J5TqA6P2GboK8b0WALr1di0dD3o5Gkh3bvNGvht3Y&amp;amp;m=3WC81GHoxUZ5Hz2DOnzUKTulLnSXOvcNwmeoQpug8E4&amp;amp;s=BfoiyLpMYL1TW0uLt84N-pUd71wiSKy24khExfVDvls&amp;amp;e="&gt;https://codepen.io/anon/pen/YRBXOo?editors=1000&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Kavish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Dec 2018 23:01:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/draw-class-quot-draw-create-rectangle-quot-doesn-t/m-p/29800#M2493</guid>
      <dc:creator>KavishGhime</dc:creator>
      <dc:date>2018-12-14T23:01:28Z</dc:date>
    </item>
  </channel>
</rss>

