<?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 MapView.toMap doesn't supprort native mouse event in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-tomap-doesn-t-supprort-native-mouse-event/m-p/1333914#M82357</link>
    <description>&lt;P&gt;From the api docs,&amp;nbsp; MapView.toMap support to take screenPoint or MouseEvent (which shows as a DOM mouse event type) and return a map Point. However, when implementing the code, I notice that the MouseEvent must be esri supported event (&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#events-summary)" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#events-summary)&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my case, I need to let&amp;nbsp; a div element to catch the right click event and convert the mouse position to be a map point, instead of relying on the mapView.on('click', clickCB).&amp;nbsp; Thus, Im not able to directly get the&amp;nbsp;esri supported event.&amp;nbsp; I wonder Is there any public utils&amp;nbsp; I can use to convert dom mouse event to esri supported event, or directly to screenPoint.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what i found from the code,&amp;nbsp; there is&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;screenUtils&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;createScreenPointFromNativeEvent&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MapRef&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;current&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;event&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;to convert dom mouse click to screenPoint, but I dont find it in the esri docs. does anyone know if I can use it in my code?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 29 Sep 2023 21:56:25 GMT</pubDate>
    <dc:creator>YangJin</dc:creator>
    <dc:date>2023-09-29T21:56:25Z</dc:date>
    <item>
      <title>MapView.toMap doesn't supprort native mouse event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-tomap-doesn-t-supprort-native-mouse-event/m-p/1333914#M82357</link>
      <description>&lt;P&gt;From the api docs,&amp;nbsp; MapView.toMap support to take screenPoint or MouseEvent (which shows as a DOM mouse event type) and return a map Point. However, when implementing the code, I notice that the MouseEvent must be esri supported event (&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#events-summary)" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#events-summary)&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my case, I need to let&amp;nbsp; a div element to catch the right click event and convert the mouse position to be a map point, instead of relying on the mapView.on('click', clickCB).&amp;nbsp; Thus, Im not able to directly get the&amp;nbsp;esri supported event.&amp;nbsp; I wonder Is there any public utils&amp;nbsp; I can use to convert dom mouse event to esri supported event, or directly to screenPoint.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what i found from the code,&amp;nbsp; there is&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;screenUtils&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;createScreenPointFromNativeEvent&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MapRef&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;current&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;event&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;to convert dom mouse click to screenPoint, but I dont find it in the esri docs. does anyone know if I can use it in my code?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 29 Sep 2023 21:56:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-tomap-doesn-t-supprort-native-mouse-event/m-p/1333914#M82357</guid>
      <dc:creator>YangJin</dc:creator>
      <dc:date>2023-09-29T21:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: MapView.toMap doesn't supprort native mouse event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-tomap-doesn-t-supprort-native-mouse-event/m-p/1333963#M82361</link>
      <description>&lt;P&gt;view.toMap supports native mouse events. All it needs are screen x and y coordinates. That's all that a ScreenPoint is.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#ScreenPoint" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#ScreenPoint&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Here is a demo:&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/odoe/pen/wvRxezP?editors=0010" target="_blank"&gt;https://codepen.io/odoe/pen/wvRxezP?editors=0010&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;elem.addEventListener("click", (event) =&amp;gt; {
	const pt = view.toMap(event);
	
	view.graphics.add({
		geometry: pt,
		attributes: {
			name: "My Point"
		},
		popupTemplate: {
			title: "{name}",
			content: "This is my mouse event"
		}
	});
});&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 30 Sep 2023 19:57:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-tomap-doesn-t-supprort-native-mouse-event/m-p/1333963#M82361</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2023-09-30T19:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: MapView.toMap doesn't supprort native mouse event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-tomap-doesn-t-supprort-native-mouse-event/m-p/1333968#M82362</link>
      <description>&lt;P&gt;hmm, weird.. in my react case, screenpoint and {screenX, screenY} from native dom event are different.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2023 23:45:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-tomap-doesn-t-supprort-native-mouse-event/m-p/1333968#M82362</guid>
      <dc:creator>YangJin</dc:creator>
      <dc:date>2023-09-30T23:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: MapView.toMap doesn't supprort native mouse event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-tomap-doesn-t-supprort-native-mouse-event/m-p/1334446#M82379</link>
      <description>&lt;P&gt;Are you cleaning up your event listeners after they are used? In React, leaving event listeners without cleaning them up may lead to unexpected behaviour. A new event listener could be added to your component on each re-render.&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.pluralsight.com/guides/how-to-cleanup-event-listeners-react" target="_self"&gt;This article&lt;/A&gt; may be of help if you are not already cleaning them up.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If this does not solve the problem, it would help a lot of you could provide some of your code for further debugging.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 08:35:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-tomap-doesn-t-supprort-native-mouse-event/m-p/1334446#M82379</guid>
      <dc:creator>Martin_B</dc:creator>
      <dc:date>2023-10-03T08:35:42Z</dc:date>
    </item>
  </channel>
</rss>

