<?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: Programmatically fire map's click event in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-fire-map-s-click-event/m-p/1412340#M84382</link>
    <description>&lt;P&gt;Well shoot...I just figured that out:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;mapView.popup.open({ 
                location: event.result.feature.geometry, // &amp;lt;- use map point of the click event
                fetchFeatures: true // &amp;lt;- fetch the selected features (if any)
            });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;It still would be nice to fire the click event though...&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 19 Apr 2024 15:59:10 GMT</pubDate>
    <dc:creator>MichaelSnook</dc:creator>
    <dc:date>2024-04-19T15:59:10Z</dc:date>
    <item>
      <title>Programmatically fire map's click event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-fire-map-s-click-event/m-p/1224345#M79082</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Hello&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;I&lt;/SPAN&gt; &lt;SPAN&gt;am&lt;/SPAN&gt; &lt;SPAN&gt;using&lt;/SPAN&gt; &lt;SPAN&gt;the&lt;/SPAN&gt; &lt;SPAN&gt;Esri&lt;/SPAN&gt;&lt;SPAN&gt;'s Javascript API 4.24. I have created functionality that allows a user to add a graphic to the map by clicking on the map. The type of graphic added depends on some previous selection that user has made. For example, selecting one option (say Option A) adds a circle graphic whereas selecting a different option (say Option B) adds a square graphic.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;So&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;my&lt;/SPAN&gt; &lt;SPAN&gt;question&lt;/SPAN&gt; &lt;SPAN&gt;is&lt;/SPAN&gt; &lt;SPAN&gt;how&lt;/SPAN&gt; &lt;SPAN&gt;can&lt;/SPAN&gt; &lt;SPAN&gt;i&lt;/SPAN&gt; &lt;SPAN&gt;programmatically&lt;/SPAN&gt; &lt;SPAN&gt;fire&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;trigger&lt;/SPAN&gt; &lt;SPAN&gt;a&lt;/SPAN&gt; &lt;SPAN&gt;map&lt;/SPAN&gt;&lt;SPAN&gt;'s click event&lt;/SPAN&gt;&lt;SPAN&gt;?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 21 Oct 2022 18:08:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-fire-map-s-click-event/m-p/1224345#M79082</guid>
      <dc:creator>Lzy</dc:creator>
      <dc:date>2022-10-21T18:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: Programmatically fire map's click event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-fire-map-s-click-event/m-p/1224433#M79086</link>
      <description>&lt;P&gt;Technically, you'd be able to do this by calling &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html" target="_self"&gt;MapView&lt;/A&gt;.&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#emit" target="_self"&gt;emit&lt;/A&gt;, and passing as close to an event object as you can. This could be problematic though, since simulating the "stopPropagation" function and the "native" property could present certain inconsistencies.&lt;/P&gt;&lt;P&gt;Probably the easiest approach would be something like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function simulateClick(mapView, mapPoint) {
	var screenPoint = mapView.toScreen(mapPoint);

	mapView.emit("click", {
		mapPoint: mapPoint,
		x: screenPoint.x,
		y: screenPoint.y,
		button: 0,
		buttons: 0,
		type: "click",
		stopPropagation: function() { },
		timestamp: Date.now(),
		native: {}
	});
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a disclaimer, I would never do this in practice, or recommend it either...I'm just answering the question as asked.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Oct 2022 00:03:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-fire-map-s-click-event/m-p/1224433#M79086</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2022-10-22T00:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: Programmatically fire map's click event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-fire-map-s-click-event/m-p/1224468#M79089</link>
      <description>&lt;P&gt;Thanks, it's a good idea。&lt;/P&gt;&lt;P&gt;If you use sketchViewModel API to draw polygons, can you click the button to punctuate with emit. How can this be achieved?&lt;/P&gt;</description>
      <pubDate>Sat, 22 Oct 2022 17:53:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-fire-map-s-click-event/m-p/1224468#M79089</guid>
      <dc:creator>Lzy</dc:creator>
      <dc:date>2022-10-22T17:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Programmatically fire map's click event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-fire-map-s-click-event/m-p/1225297#M79119</link>
      <description>&lt;P&gt;I don't know the answer to that.&amp;nbsp; Since it's off-topic, you might consider posting it as a separate question for greater visibility.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 17:35:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-fire-map-s-click-event/m-p/1225297#M79119</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2022-10-25T17:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: Programmatically fire map's click event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-fire-map-s-click-event/m-p/1412314#M84381</link>
      <description>&lt;P&gt;Hi...any luck on this?&amp;nbsp; No matter what I try I can't seem to get the click to fire.&amp;nbsp; The mapview.emit does not seem to work in this case.&amp;nbsp; I am trying to get a forced map click to run an identify programatically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Apr 2024 15:27:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-fire-map-s-click-event/m-p/1412314#M84381</guid>
      <dc:creator>MichaelSnook</dc:creator>
      <dc:date>2024-04-19T15:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: Programmatically fire map's click event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-fire-map-s-click-event/m-p/1412340#M84382</link>
      <description>&lt;P&gt;Well shoot...I just figured that out:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;mapView.popup.open({ 
                location: event.result.feature.geometry, // &amp;lt;- use map point of the click event
                fetchFeatures: true // &amp;lt;- fetch the selected features (if any)
            });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;It still would be nice to fire the click event though...&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Apr 2024 15:59:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-fire-map-s-click-event/m-p/1412340#M84382</guid>
      <dc:creator>MichaelSnook</dc:creator>
      <dc:date>2024-04-19T15:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Programmatically fire map's click event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-fire-map-s-click-event/m-p/1511652#M85131</link>
      <description>&lt;P&gt;Hi, Is anyone able to fire the event with view.emit because what ever I tried I'm not able to fire the event programmatically. Can anyone be specific about the solution?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sai Anand Peketi&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2024 15:40:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-fire-map-s-click-event/m-p/1511652#M85131</guid>
      <dc:creator>SaiPeketi</dc:creator>
      <dc:date>2024-07-29T15:40:03Z</dc:date>
    </item>
  </channel>
</rss>

