<?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 Cancel the MapView ClickEvent if a Widget is not extended. in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cancel-the-mapview-clickevent-if-a-widget-is-not/m-p/1158325#M76824</link>
    <description>&lt;P&gt;I'm trying to cancel a ClickEvent whenever a Polygon is clicked and the Sketch Widget is not expanded.&lt;BR /&gt;&lt;BR /&gt;I've tried the following code.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I think that the problem is that the rest of the ClickEvent does not get cancelled by 'stopPropagation' because it is in a promise.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I've tried coming up with different ways, but I am at a loss here. Any tips would be helpful!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this.mapView.on("immediate-click", (clickEvent: esri.MapViewImmediateClickEvent) =&amp;gt; {
      console.log("Mapview clicked.");
      let sketchExpandWidget: esri.Expand = this.esriWidgetService.getSketchExpandWidget();

      this.mapView.hitTest(clickEvent).then((hit: esri.HitTestResult) =&amp;gt; {
        if (!sketchExpandWidget.expanded) {
          //This does not cancel the propagation. Most likely caused by the delay of the callback.
          clickEvent.stopPropagation(); 
        }
      });
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Apr 2022 13:20:20 GMT</pubDate>
    <dc:creator>WesleySchoonbeek</dc:creator>
    <dc:date>2022-04-12T13:20:20Z</dc:date>
    <item>
      <title>Cancel the MapView ClickEvent if a Widget is not extended.</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cancel-the-mapview-clickevent-if-a-widget-is-not/m-p/1158325#M76824</link>
      <description>&lt;P&gt;I'm trying to cancel a ClickEvent whenever a Polygon is clicked and the Sketch Widget is not expanded.&lt;BR /&gt;&lt;BR /&gt;I've tried the following code.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I think that the problem is that the rest of the ClickEvent does not get cancelled by 'stopPropagation' because it is in a promise.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I've tried coming up with different ways, but I am at a loss here. Any tips would be helpful!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this.mapView.on("immediate-click", (clickEvent: esri.MapViewImmediateClickEvent) =&amp;gt; {
      console.log("Mapview clicked.");
      let sketchExpandWidget: esri.Expand = this.esriWidgetService.getSketchExpandWidget();

      this.mapView.hitTest(clickEvent).then((hit: esri.HitTestResult) =&amp;gt; {
        if (!sketchExpandWidget.expanded) {
          //This does not cancel the propagation. Most likely caused by the delay of the callback.
          clickEvent.stopPropagation(); 
        }
      });
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 13:20:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cancel-the-mapview-clickevent-if-a-widget-is-not/m-p/1158325#M76824</guid>
      <dc:creator>WesleySchoonbeek</dc:creator>
      <dc:date>2022-04-12T13:20:20Z</dc:date>
    </item>
  </channel>
</rss>

