<?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: How to refresh map coordinates if browser window adds scrollbars? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-refresh-map-coordinates-if-browser-window/m-p/61527#M5410</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Chris,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you post your code or a fiddle? That might help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Feb 2015 20:30:42 GMT</pubDate>
    <dc:creator>TimWitt2</dc:creator>
    <dc:date>2015-02-12T20:30:42Z</dc:date>
    <item>
      <title>How to refresh map coordinates if browser window adds scrollbars?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-refresh-map-coordinates-if-browser-window/m-p/61526#M5409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.&amp;nbsp; I'm working on a simple app that lets the user click on the map to select a polygon and then the attribute information is presented in a results area.&amp;nbsp; My map is&amp;nbsp; on the right hand side of the screen (position = fixed).&amp;nbsp; The results panel is on the left hand side.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the attribute results get populated, they sometimes extend beyond the screen bottom.&amp;nbsp; When this happens, the browser window creates a vertical scrollbar, and I can scroll down and see all the attributes (the map stays fixed on the right hand side of the screen).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is, the map isn't aware of the addition of the scrollbar, or if I've scrolled down.&amp;nbsp; If I then click another point on the map, the coordinates are offset by the scrollbar width, and by the amount I've scrolled down.&amp;nbsp; So the wrong polygon gets selected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sure others have run into this.&amp;nbsp; Is there are easy way to fix this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2015 20:16:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-refresh-map-coordinates-if-browser-window/m-p/61526#M5409</guid>
      <dc:creator>ChrisDunlop</dc:creator>
      <dc:date>2015-02-12T20:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to refresh map coordinates if browser window adds scrollbars?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-refresh-map-coordinates-if-browser-window/m-p/61527#M5410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Chris,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you post your code or a fiddle? That might help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2015 20:30:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-refresh-map-coordinates-if-browser-window/m-p/61527#M5410</guid>
      <dc:creator>TimWitt2</dc:creator>
      <dc:date>2015-02-12T20:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to refresh map coordinates if browser window adds scrollbars?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-refresh-map-coordinates-if-browser-window/m-p/61528#M5411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, here's a stripped down example.&amp;nbsp; Look at the screenPoint coordinates - the upper left of the map is 0,0. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, click the Add Attributes button.&amp;nbsp; The screenPoint coordinates get shifted about -11 pixels. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try scrolling down.&amp;nbsp; You'll see the screenPoint Y coordinates get messed up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you resize the browser window the coordinates gets reset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;head&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&amp;gt;&lt;BR /&gt;&amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt;&lt;BR /&gt;&amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script src="&lt;A href="https://js.arcgis.com/3.11/&amp;quot;&amp;gt;&amp;lt;/script"&gt;https://js.arcgis.com/3.11/"&amp;gt;&amp;lt;/script&lt;/A&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;lt;link rel="stylesheet" href="&lt;A href="https://js.arcgis.com/3.8/js/esri/css/esri.css"&gt;https://js.arcgis.com/3.8/js/esri/css/esri.css&lt;/A&gt;"&amp;gt;&lt;BR /&gt;&amp;lt;link rel="stylesheet" href="&lt;A href="https://js.arcgis.com/3.7/js/dojo/dijit/themes/claro/claro.css"&gt;https://js.arcgis.com/3.7/js/dojo/dijit/themes/claro/claro.css&lt;/A&gt;"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;style&amp;gt;&lt;BR /&gt;#map&lt;BR /&gt;{ &lt;BR /&gt; position: fixed;&lt;BR /&gt; margin: 0px; &lt;BR /&gt; padding: 0px; &lt;BR /&gt; top: 10px;&lt;BR /&gt; right: 10px;&lt;BR /&gt; height: calc(100% - 20px);&lt;BR /&gt; width: calc(49% - 20px);&lt;/P&gt;&lt;P&gt; border: 2px solid #BBBBBB;&lt;BR /&gt; border-style: solid;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;#attributeContainer&lt;BR /&gt;{&lt;BR /&gt; position: absolute;&lt;BR /&gt; left: 5px;&lt;BR /&gt; top:10px;&lt;BR /&gt; display: block;&lt;BR /&gt; padding:10px;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; width:calc(49% - 20px); &lt;/P&gt;&lt;P&gt; border: 1px solid #BBBBBB;&lt;BR /&gt; border-style: solid;&lt;BR /&gt; background:#dbebf7;&lt;/P&gt;&lt;P&gt; z-index: 60;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;lt;/style&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script&amp;gt;&lt;/P&gt;&lt;P&gt;function addAttributes() {&lt;/P&gt;&lt;P&gt; theTxt=""&lt;BR /&gt; for (i=0; i&amp;lt;1000; i++) {&lt;BR /&gt;&amp;nbsp; theTxt=theTxt+"yada yada yada " &lt;BR /&gt; } &lt;BR /&gt; document.getElementById("attributes").innerHTML=theTxt&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;require([&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "dojo/parser", &lt;BR /&gt; "dojo/dom",&lt;BR /&gt; "dojo/on",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "esri/config", &lt;BR /&gt; "esri/map", &lt;BR /&gt; "esri/geometry/Extent",&lt;BR /&gt; "esri/layers/ArcGISDynamicMapServiceLayer",&lt;BR /&gt; "esri/layers/ArcGISTiledMapServiceLayer",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "dojo/domReady!"&lt;BR /&gt; ], function(&lt;BR /&gt;&amp;nbsp; parser, &lt;BR /&gt;&amp;nbsp; dom,&lt;BR /&gt;&amp;nbsp; on,&lt;BR /&gt;&amp;nbsp; esriConfig, &lt;BR /&gt;&amp;nbsp; Map,&lt;BR /&gt;&amp;nbsp; Extent,&lt;BR /&gt;&amp;nbsp; ArcGISDynamicMapServiceLayer, &lt;BR /&gt;&amp;nbsp; ArcGISTiledMapServiceLayer&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt; {&lt;BR /&gt;&amp;nbsp; // create layout dijits&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parser.parse();&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // specify proxy for request with URL lengths &amp;gt; 2k characters&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //esriConfig.defaults.io.proxyUrl = "../proxy/EsriProxyFile";&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; esriConfig.defaults.map.basemaps.OCBasemap = {&lt;BR /&gt;&amp;nbsp; baseMapLayers: [&lt;BR /&gt;&amp;nbsp; { url: "&lt;A href="https://webmaps.orcity.org/arcgis/rest/services/Basemap/MapServer"&gt;https://webmaps.orcity.org/arcgis/rest/services/Basemap/MapServer&lt;/A&gt;" }&lt;BR /&gt;&amp;nbsp; ],&lt;BR /&gt;&amp;nbsp;&amp;nbsp; title: "OCBasemap"&lt;BR /&gt;&amp;nbsp; };&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; var imageParameters=new esri.layers.ImageParameters()&lt;BR /&gt;&amp;nbsp; imageParameters.format="png32"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map = new Map("map",{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; zoom: 1,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; scaleSlider: "small",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; basemap: "OCBasemap",&lt;BR /&gt;&amp;nbsp; }); &lt;/P&gt;&lt;P&gt;&amp;nbsp; var cityLimits = new ArcGISDynamicMapServiceLayer("&lt;A href="https://webmaps.orcity.org/arcgis/rest/services/CityLimits/MapServer&amp;quot;,{&amp;quot;imageParameters&amp;quot;:imageParameters"&gt;https://webmaps.orcity.org/arcgis/rest/services/CityLimits/MapServer",{"imageParameters":imageParameters&lt;/A&gt;});&lt;BR /&gt;&amp;nbsp; map.addLayer(cityLimits);&lt;/P&gt;&lt;P&gt;&amp;nbsp; map.on("load", mapSetup);&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp; function mapSetup() {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; map.showZoomSlider();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; map.enableScrollWheelZoom();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; map.enableRubberBandZoom()&lt;BR /&gt;&amp;nbsp;&amp;nbsp; map.on("mouse-move", showCoordinates);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; map.on("mouse-drag", showCoordinates);&lt;BR /&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; map.setMapCursor("pointer")&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; function showCoordinates(e)&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; sp=e.screenPoint&lt;BR /&gt;&amp;nbsp;&amp;nbsp; mp=e.mapPoint&lt;BR /&gt;&amp;nbsp;&amp;nbsp; dom.byId("info").innerHTML = "mapPoint="+mp.x.toFixed(3) + ", " + mp.y.toFixed(3) + "&amp;nbsp;&amp;nbsp; screenPoint=" + sp.x.toFixed(3) + ", " + sp.y.toFixed(3);&lt;BR /&gt;&amp;nbsp; }&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt; }&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;body class="claro"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;div id="attributeContainer"&amp;gt;&lt;BR /&gt; &amp;lt;div id="attributes"&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;button onclick="addAttributes()"&amp;gt;Add Attributes&amp;lt;/button&amp;gt;&lt;BR /&gt; &amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;div data-dojo-type="dijit.layout.BorderContainer" &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; data-dojo-props="design:'headline',gutters:false" &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; style="width: 100%; height: 100%; margin: 0;"&amp;gt;&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;div id="map" class="map" &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data-dojo-type="dijit.layout.ContentPane" &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data-dojo-props="region:'center'"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; style="overflow:hidden;"&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;div id="info" style="position:absolute; left:5px; bottom:5px; color:#000; z-index:50;"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/body&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2015 21:08:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-refresh-map-coordinates-if-browser-window/m-p/61528#M5411</guid>
      <dc:creator>ChrisDunlop</dc:creator>
      <dc:date>2015-02-12T21:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to refresh map coordinates if browser window adds scrollbars?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-refresh-map-coordinates-if-browser-window/m-p/61529#M5412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Chris,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this might to the trick? &lt;A href="https://developers.arcgis.com/javascript/jsapi/map-amd.html#reposition" title="https://developers.arcgis.com/javascript/jsapi/map-amd.html#reposition"&gt;Map | API Reference | ArcGIS API for JavaScript&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;map.reposition();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2015 21:14:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-refresh-map-coordinates-if-browser-window/m-p/61529#M5412</guid>
      <dc:creator>TimWitt2</dc:creator>
      <dc:date>2015-02-12T21:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to refresh map coordinates if browser window adds scrollbars?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-refresh-map-coordinates-if-browser-window/m-p/61530#M5413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Tim!&amp;nbsp; I added map.resposition() after my code that generates the attribute list, and also in a JQuery (window).scroll function.&amp;nbsp; That seems to catch everything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2015 21:53:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-refresh-map-coordinates-if-browser-window/m-p/61530#M5413</guid>
      <dc:creator>ChrisDunlop</dc:creator>
      <dc:date>2015-02-12T21:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to refresh map coordinates if browser window adds scrollbars?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-refresh-map-coordinates-if-browser-window/m-p/61531#M5414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could use CSS rules to prevent the window scrollbar from appearing at all. Set a height value to the attributeContainer div and then only scroll it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;#attributeContainer
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; /* other styles... */
&amp;nbsp;&amp;nbsp;&amp;nbsp; overflow-y: scroll;
&amp;nbsp;&amp;nbsp;&amp;nbsp; height: calc(100% - 38px);
}&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See this &lt;A href="http://jsbin.com/higuxaquhe" rel="nofollow noopener noreferrer" target="_blank"&gt;working example&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:20:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-refresh-map-coordinates-if-browser-window/m-p/61531#M5414</guid>
      <dc:creator>OwenEarley</dc:creator>
      <dc:date>2021-12-10T22:20:04Z</dc:date>
    </item>
  </channel>
</rss>

