<?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 How to complete draw action in ArcGIS Maps SDK for JavaScript? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-complete-draw-action-in-arcgis-maps-sdk-for/m-p/1364162#M83198</link>
    <description>&lt;P&gt;I use&amp;nbsp; version 4.28 of&amp;nbsp;ArcGIS Maps SDK for JavaScript. I have a button that activate Draw object for drawing, for example, a polyline. But an user could change its mind after he/she pushed the button, so I added other button that should to interrupt (complete) the drawing action. So I added a code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;document.getElementById("btnDrop").onclick = () =&amp;gt; {
        draw.complete();
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;that should interrupt the drawing action. But it does not work. Here a sample that I did in CodePen:&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/ekleiman22/pen/WNmNgYv?editors=1000" target="_self"&gt;Sample for drawing polyline and a button for cancelling of drawing&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I need a help.&lt;/P&gt;</description>
    <pubDate>Sat, 23 Dec 2023 09:20:25 GMT</pubDate>
    <dc:creator>ekleiman22</dc:creator>
    <dc:date>2023-12-23T09:20:25Z</dc:date>
    <item>
      <title>How to complete draw action in ArcGIS Maps SDK for JavaScript?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-complete-draw-action-in-arcgis-maps-sdk-for/m-p/1364162#M83198</link>
      <description>&lt;P&gt;I use&amp;nbsp; version 4.28 of&amp;nbsp;ArcGIS Maps SDK for JavaScript. I have a button that activate Draw object for drawing, for example, a polyline. But an user could change its mind after he/she pushed the button, so I added other button that should to interrupt (complete) the drawing action. So I added a code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;document.getElementById("btnDrop").onclick = () =&amp;gt; {
        draw.complete();
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;that should interrupt the drawing action. But it does not work. Here a sample that I did in CodePen:&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/ekleiman22/pen/WNmNgYv?editors=1000" target="_self"&gt;Sample for drawing polyline and a button for cancelling of drawing&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I need a help.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Dec 2023 09:20:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-complete-draw-action-in-arcgis-maps-sdk-for/m-p/1364162#M83198</guid>
      <dc:creator>ekleiman22</dc:creator>
      <dc:date>2023-12-23T09:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to complete draw action in ArcGIS Maps SDK for JavaScript?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-complete-draw-action-in-arcgis-maps-sdk-for/m-p/1364190#M83200</link>
      <description>&lt;P&gt;It seems I know how to solve my problem. I made changes in&amp;nbsp;&lt;A href="https://codepen.io/ekleiman22/pen/WNmNgYv?editors=1000" target="_self"&gt;Sample for drawing polyline and a button for cancelling of drawing&lt;/A&gt;&amp;nbsp;.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var toDraw = true;
....
document.getElementById("btnDrop").onclick = () =&amp;gt; {
        toDraw = false;
        draw.complete();
    }
....
action.on(
        [
          "vertex-add",
          "vertex-remove",
          "cursor-update",
          "redo",
          "undo"          
        ],
        updateVertices
      );
      //action.on("draw-complete", special);
....
function updateVertices(event) {
        if (!toDraw)
            return;
....&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 24 Dec 2023 06:07:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-complete-draw-action-in-arcgis-maps-sdk-for/m-p/1364190#M83200</guid>
      <dc:creator>ekleiman22</dc:creator>
      <dc:date>2023-12-24T06:07:55Z</dc:date>
    </item>
  </channel>
</rss>

