Skip to content

Zooming out below the equator pans the map #114

Closed
shawnbot opened this Issue Mar 21, 2012 · 2 comments

2 participants

@shawnbot
Stamen Design member

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, so I'm not sure if this is a new issue or what.

Could it be related to enforceLimits()?

@shawnbot
Stamen Design member

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
Stamen Design member
tmcw commented Mar 21, 2012

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)

@tmcw tmcw added a commit that closed this issue Mar 23, 2012
@tmcw tmcw Fix enforcePanLimits. This was coded in a way that compared
coordinates across zoom ranges - this fix simply changes
it so that the compare coords are zoomed correctly. This
fixes #114.
34db798
@tmcw tmcw closed this in 34db798 Mar 23, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.