stamen / modestmaps-js

Modest Maps javascript port
http://modestmaps.com
566 stars 152 forks source link

Zooming out below the equator pans the map #114

Closed shawnbot closed 12 years ago

shawnbot commented 12 years ago

This is a pretty big one. I've whipped up a test case that shows the latitude changing when the map zooms out from a point below the equator. Watch the output as it zooms out 5 times, with a 2-second delay each time. Zooming from 8 to 7 is fine, but then from 7 to 6 produces a change in latitude of .47º. From 6 to 5 is even more extreme: a 5º drift. The longitude is stable.

For each step I'm spitting out the start and end center coordinate and location of each, along with the drift (both as a delta in degrees latitude and longitude and as a percentage of the start), but there doesn't appear to be much of a pattern.

Strangely enough, this problem doesn't show up on [http://tiles.mapbox.com/usaid-horn/map/map_1316100684907](MapBox maps), so I'm not sure if this is a new issue or what.

Could it be related to enforceLimits()?

shawnbot commented 12 years ago

Note that this bug rears its head on TileStache previews (pop open the console and type: map.zoomOut()) as well, which use an older version of MM.

It also causes issues on maps.stamen (click the zoom out button to see the jump).

tmcw commented 12 years ago

This is caused by the bottom right coordlimit being 1 instead of infinity here: https://github.com/stamen/modestmaps-js/blob/master/src/map.js#L55

Changing it to infinity fixes the bug but I'm not sure what other behavior it modifies - need to take a slightly deeper look.

(second look reveals, duh, this lets users scroll infinitely far down the page)