<?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: Adding a click handler on a Graphic with reactiveUtils in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-a-click-handler-on-a-graphic-with/m-p/1319348#M81994</link>
    <description>&lt;P&gt;There are no click events on graphics due to the drawing engine. The hiTest sample you linked is the recommended way to "listen" for when you interact with graphics drawn on the map.&lt;/P&gt;</description>
    <pubDate>Wed, 16 Aug 2023 20:29:21 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2023-08-16T20:29:21Z</dc:date>
    <item>
      <title>Adding a click handler on a Graphic with reactiveUtils</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-a-click-handler-on-a-graphic-with/m-p/1319267#M81988</link>
      <description>&lt;P&gt;We're building out a tool (using version &lt;SPAN&gt;4.25.5&lt;/SPAN&gt;) that allows drawing shapes on a MapView (think boundry builder), and once constructed, we'd like to provide the ability to change the shape. So, we've drawn a Graphic with a Polygon and a SimpleFillSymbol to represent the boundry, and at each vertex, we overlay another Graphic with a Point and a SimpleMarkerSymbol. We expected to be able to add a listener onto the overlayed Graphic so we could be notified of hovers, clicks, and so on.&lt;/P&gt;&lt;P&gt;This example for &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html#on" target="_self"&gt;reactiveUtils&lt;/A&gt;.on looked really promising!&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;reactiveUtils.on(
  () =&amp;gt; view,
  "click",
  (event) =&amp;gt; {
    console.log("Click event emitted: ", event);
  });&lt;/LI-CODE&gt;&lt;P&gt;However, instead of the first argument returning &lt;FONT face="courier new,courier"&gt;view&lt;/FONT&gt;, we wanted to return a Graphic (or it's Geometry, or???). Perhaps it's just an issue with the typescript definitions, but we're getting complaints that the Graphic is not an "Evented" or "EventTarget", neither of which come up when searching the online docs.&lt;/P&gt;&lt;P&gt;In the interim, we're using a hitTest, as demonstrated in &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/view-hittest/" target="_self"&gt;one of the samples&lt;/A&gt;, but attaching a listener on the individual Graphics is a preferred approach. Any suggestions on how to attach a listener onto a Graphic (or one of it's attributes) would be greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2023 18:37:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-a-click-handler-on-a-graphic-with/m-p/1319267#M81988</guid>
      <dc:creator>ToddRunstein</dc:creator>
      <dc:date>2023-08-16T18:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a click handler on a Graphic with reactiveUtils</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-a-click-handler-on-a-graphic-with/m-p/1319348#M81994</link>
      <description>&lt;P&gt;There are no click events on graphics due to the drawing engine. The hiTest sample you linked is the recommended way to "listen" for when you interact with graphics drawn on the map.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Aug 2023 20:29:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-a-click-handler-on-a-graphic-with/m-p/1319348#M81994</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2023-08-16T20:29:21Z</dc:date>
    </item>
  </channel>
</rss>

