<?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: Pan map by pixel (offset map centering) in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pan-map-by-pixel-offset-map-centering/m-p/344018#M31761</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I would like to offset the map recentering by x number of pixels. How can I do this.&lt;BR /&gt;&lt;BR /&gt;map.centerAt(point) - The argument takes a coordinates. However I would like to move the center 50 px to the left from real center. &lt;BR /&gt;&lt;BR /&gt;I guess I could calculate the resolution of the pixel based on the current map scale and than calculate the distance I need to move the map. But I am wondering if there is a simpler way of panning the map by defining number of pixels, rather than the coordinates at which to center.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Martin&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Martin, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Take a look at the &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/jsapi/esri.geometry.screenutils-amd.html"&gt;screenUtils&lt;/A&gt;&lt;SPAN&gt; class. By using this class you can convert your point to &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/jsapi/screenpoint-amd.html"&gt;ScreenPoint&lt;/A&gt;&lt;SPAN&gt;, offset it the way you like and convert it back to MapPoint.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me know if it helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Feb 2014 10:43:58 GMT</pubDate>
    <dc:creator>RobertoPepato</dc:creator>
    <dc:date>2014-02-24T10:43:58Z</dc:date>
    <item>
      <title>Pan map by pixel (offset map centering)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pan-map-by-pixel-offset-map-centering/m-p/344017#M31760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would like to offset the map recentering by x number of pixels. How can I do this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;map.centerAt(point) - The argument takes a coordinates. However I would like to move the center 50 px to the left from real center. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I guess I could calculate the resolution of the pixel based on the current map scale and than calculate the distance I need to move the map. But I am wondering if there is a simpler way of panning the map by defining number of pixels, rather than the coordinates at which to center.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Martin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Feb 2014 09:04:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pan-map-by-pixel-offset-map-centering/m-p/344017#M31760</guid>
      <dc:creator>MartinSirkovsky</dc:creator>
      <dc:date>2014-02-24T09:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Pan map by pixel (offset map centering)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pan-map-by-pixel-offset-map-centering/m-p/344018#M31761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I would like to offset the map recentering by x number of pixels. How can I do this.&lt;BR /&gt;&lt;BR /&gt;map.centerAt(point) - The argument takes a coordinates. However I would like to move the center 50 px to the left from real center. &lt;BR /&gt;&lt;BR /&gt;I guess I could calculate the resolution of the pixel based on the current map scale and than calculate the distance I need to move the map. But I am wondering if there is a simpler way of panning the map by defining number of pixels, rather than the coordinates at which to center.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Martin&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Martin, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Take a look at the &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/jsapi/esri.geometry.screenutils-amd.html"&gt;screenUtils&lt;/A&gt;&lt;SPAN&gt; class. By using this class you can convert your point to &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/jsapi/screenpoint-amd.html"&gt;ScreenPoint&lt;/A&gt;&lt;SPAN&gt;, offset it the way you like and convert it back to MapPoint.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me know if it helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Feb 2014 10:43:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pan-map-by-pixel-offset-map-centering/m-p/344018#M31761</guid>
      <dc:creator>RobertoPepato</dc:creator>
      <dc:date>2014-02-24T10:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: Pan map by pixel (offset map centering)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pan-map-by-pixel-offset-map-centering/m-p/344019#M31762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the tip. I investigating further after I posted my question and that is what I used.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my code, using Jquery selectors:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;// Get width of map div&amp;nbsp; var mapDivWidth = $("#mapDiv").width();&amp;nbsp; // Get width of the div which is partialy obscuring the mapDiv var tableListWidth = $("#propertyList").width();&amp;nbsp; // Get the min and max X coordinate of the current map&amp;nbsp; var minX = map.toMap(esri.geometry.ScreenPoint(0,0)); var maxX = map.toMap(esri.geometry.ScreenPoint((mapDivWidth-1),0));&amp;nbsp; // Calculate the current pixel resolution var pointResolution = (maxX.x - minX.x)/mapDivWidth;&amp;nbsp;&amp;nbsp; // Get the correct map center var currentMapCenter = (mapDivWidth - tableListWidth) / 2;&amp;nbsp; // Get the wished offset in coordinate system units offset = ((mapDivWidth / 2) - currentMapCenter) * pointResolution;&amp;nbsp; //...... follows the code where I apply the offset&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Feb 2014 11:08:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pan-map-by-pixel-offset-map-centering/m-p/344019#M31762</guid>
      <dc:creator>MartinSirkovsky</dc:creator>
      <dc:date>2014-02-24T11:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Pan map by pixel (offset map centering)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pan-map-by-pixel-offset-map-centering/m-p/344020#M31763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Martin, you should mark your own post as the answer to help others who might have this same question.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Feb 2014 13:19:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pan-map-by-pixel-offset-map-centering/m-p/344020#M31763</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2014-02-24T13:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: Pan map by pixel (offset map centering)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pan-map-by-pixel-offset-map-centering/m-p/344021#M31764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is a similar question &amp;amp; answer that is relevant here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/thread/238088"&gt;Is there a way to animate a padding change?&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Aug 2019 05:11:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/pan-map-by-pixel-offset-map-centering/m-p/344021#M31764</guid>
      <dc:creator>RyannGalea</dc:creator>
      <dc:date>2019-08-12T05:11:08Z</dc:date>
    </item>
  </channel>
</rss>

