Select to view content in your preferred language

Possible Bug: In JS API 3.7, Mobile Popup not displayed at correct position

1246
5
10-04-2013 07:39 AM
RohitKumar
New Contributor
Mobile Popup is not taking the correct click position in API 3.7, while the same is working fine in 3.6. Using "http://js.arcgis.com/3.7/",Popup always appear at top-left corner in mobile (same works fine if we use "http://js.arcgis.com/3.6/").

I am testing this in iPhone 5 iOS 6.0
[ATTACH=CONFIG]28048[/ATTACH]
Has anyone seen this issue?

Any help is greatly appreciated.
0 Kudos
5 Replies
KellyHutchins
Esri Notable Contributor
I ran a quick test using the mobile popup sample and it worked for me. Tested on an iphone with ios7.

https://developers.arcgis.com/en/javascript/jssamples/widget_mobilepopup.html
0 Kudos
RohitKumar
New Contributor
I downloaded the sample http://help.arcgis.com/EN/webapi/javascript/arcgis/jssamples/widget_mobilepopup.html and added dojox/mobile in the require array. It is working fine in the browser but in mobile, popup position is not correct. And when i change the JS API from 3.7 to 3.6, its working fine.[ATTACH=CONFIG]28332[/ATTACH]

All suggestions are welcome.
0 Kudos
RobSpeer
Deactivated User
Yes, I am experiencing the same thing with the onClick event in 3.7.  It works great in a browser, or a browser emulating a mobile device.  Using an actual phone yields different results. 

In a browser, the onClick event in the code below yields one console log and one alert per click in a browser.

On a phone you get three alerts.  The first alert always returns "NaN, NaN" for the mapPoint and "undefined, undefined" for the evt.x and y.  The subsequent two alerts on the phone give the correct mapPoint and evt coordinates.  So each onClick fires three events, the first of which doesn't return coordinates.

Here is how to see this issue on an iPhone:

    <script src="http://js.arcgis.com/3.7/"></script>
    <script>
      var map;
      require(["esri/map","dojox/mobile","dojo/domReady!"],
      function(Map, dojoxMobile){
        map = new Map("map", {basemap: "topo", center: [-59.48, 44.066], zoom: 4});

        map.on("click",function(evt){
          console.log("mapPoint: " + evt.mapPoint.x + ", " + evt.mapPoint.y);
          console.log("evt: " + evt.x + ", " + evt.y);
          alert("mapPoint: " + evt.mapPoint.x + ", " + evt.mapPoint.y + "\nevt: " + evt.y + ", " + evt.x);
        });
      });
    </script>


So why the three events?
0 Kudos
KellyHutchins
Esri Notable Contributor
0 Kudos
RobSpeer
Deactivated User
Awesome.  Like Derek said in that post, this did the trick:

document.dojoClick = false;


after dojox/mobile modules are loaded.

Thanks for the quick response!
0 Kudos