<?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: Can we create our own toScreen method? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/can-we-create-our-own-toscreen-method/m-p/1283470#M80993</link>
    <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please take a look at this codepen as this shows how to transform map points to screen points:&amp;nbsp; &lt;A href="https://codepen.io/ycabon/pen/ExdXXjP?editors=0011" target="_blank"&gt;https://codepen.io/ycabon/pen/ExdXXjP?editors=0011&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Apr 2023 17:11:21 GMT</pubDate>
    <dc:creator>UndralBatsukh</dc:creator>
    <dc:date>2023-04-27T17:11:21Z</dc:date>
    <item>
      <title>Can we create our own toScreen method?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/can-we-create-our-own-toscreen-method/m-p/1282382#M80954</link>
      <description>&lt;P&gt;I am using toScreen method of map to convert the map points into screen points, which are then used to calculate the extents of a graphic drawn in the graphic layer in screen points. These screen points changes every time we move the map or zoom in/out. I have to recalculate the screen points again every time map is moved to keep the extents updated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My goal is to keep track of map extents in screen points of each graphic drawn. But the recalculation takes a lot of time if the number of graphics are high. So I am trying to make use of web workers to do the calculation but can't use the same toScreen method in web worker.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can we create our own toScreen method that can be added in web worker to do the calculation in seperate thread? I just need to understand how the screen points are calculated in map.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2023 15:38:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/can-we-create-our-own-toscreen-method/m-p/1282382#M80954</guid>
      <dc:creator>PrashantR</dc:creator>
      <dc:date>2023-04-25T15:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: Can we create our own toScreen method?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/can-we-create-our-own-toscreen-method/m-p/1282888#M80968</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Can you please tell me what are you trying to do by achieving what you described above? Only asking because there may an easier solution.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 16:08:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/can-we-create-our-own-toscreen-method/m-p/1282888#M80968</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2023-04-26T16:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Can we create our own toScreen method?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/can-we-create-our-own-toscreen-method/m-p/1283184#M80986</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/53756"&gt;@UndralBatsukh&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks for the response!&lt;/P&gt;&lt;P&gt;Let me elaborate on what I am exactly trying to do.&lt;/P&gt;&lt;P&gt;I have a graphics layer and I want to draw graphics in such a way that it does not overlap any other existing graphic.&amp;nbsp; I am able to do it by calculating the extents of each graphic in screen points and then check for any intersection with existing extents while drawing the new graphic. This way I am able to try multiple positions for the graphic to draw and use the position where there is no overlap.&lt;/P&gt;&lt;P&gt;This works fine but the only issue is that it is very expensive to recalculate the screen points every time user moves the map&amp;nbsp; as the screenpoints changes. So everytime I have to recalculate the extents for each graphic. I also want to add a feature where if I zoom in then I would like to redraw the entire graphic layer without any overlapping graphics, this also takes at least 3-4 seconds and it block the UI.&lt;/P&gt;&lt;P&gt;To keep the UI responsive, I thought of using web workers to&amp;nbsp; do the calculation. But we can't access the toScreen(Or any method from main thread) in web worker as it is a seperate thread and does not have access to DOM &amp;amp; window object.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I was wondering if we could create our own toScreen method in web worker that does the exact same this as MapView's toScreen method that would do it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you think this is possible? Or any other solution that can help me here...?&lt;/P&gt;&lt;P&gt;Thanks again for the help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2023 04:32:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/can-we-create-our-own-toscreen-method/m-p/1283184#M80986</guid>
      <dc:creator>PrashantR</dc:creator>
      <dc:date>2023-04-27T04:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: Can we create our own toScreen method?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/can-we-create-our-own-toscreen-method/m-p/1283470#M80993</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please take a look at this codepen as this shows how to transform map points to screen points:&amp;nbsp; &lt;A href="https://codepen.io/ycabon/pen/ExdXXjP?editors=0011" target="_blank"&gt;https://codepen.io/ycabon/pen/ExdXXjP?editors=0011&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2023 17:11:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/can-we-create-our-own-toscreen-method/m-p/1283470#M80993</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2023-04-27T17:11:21Z</dc:date>
    </item>
  </channel>
</rss>

