rexbradford

Possible bug with map.centerAndZoom

Discussion created by rexbradford on Nov 7, 2012
Latest reply on Nov 7, 2012 by rexbradford
I have a repeatable bug in an app, where in certain circumstances Internet Explorer 9 fails to map.centerAndZoom properly.  Other browsers I've tested (Firefox, Safari, Chrome, Opera) are fine.  The condition seems to be when the starting point has essentially the same longitude as the desired destination (doesn't need to be exact).  In this scenario, but only the first time (I swear), the map just zooms straight in without adjusting lat or lon.  Both the map and the desired destination are Web Mercator spatial refs (wkid: 102100).

In other words, the bug is triggered by code kind of like so, where xnew, ynew, and zoomLevel are supplied (and where xnew is not much different from current center x of the map):

        var zoomLevel = 4;   // or whatever, zooming in in this case
        var WMRef = new esri.SpatialReference({wkid: 102100});
 var newCenter = new esri.geometry.Point(xnew, ynew, WMRef);
 map.centerAndZoom(newCenter, zoomLevel);


in IE9 and no other browser, first execution will just zoom straight in with no panning at all.  I do not have an isolated 1-page for this, no.

If I put the line:
        xnew += 1000000"

before the code above, then the zoomcenter works (though zoomcenters to the wrong spot of course), because the longitude is apparently different enough to cure the bug.

Anybody seen this?

Rex Bradford
Direct Relief International

Outcomes