Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

map.setCenter ignores latitude #135

Closed
manelclos opened this Issue Jun 18, 2012 · 7 comments

Comments

Projects
None yet
3 participants

Version 1.0.0-alpha3 works correctly, version beta1 ignores latitude. Using setExtent() and setZoom() works as a workaround

Contributor

tmcw commented Jun 19, 2012

Can you test with more current version of Modest Maps, like 2.0.0?

Fails with 2.0.0 too. The code is from http://modestmaps.com/index.html

var template = 'http://c.tiles.mapbox.com/v3/mapbox.mapbox-light/{Z}/{X}/{Y}.png';
var provider = new MM.TemplatedLayer(template);
var map = new MM.Map('map', provider);
map.setCenter({ lat: 42.51, lon: 2.68 }).setZoom(9);

Contributor

tmcw commented Jun 19, 2012

Ah, that problem. Call setZoom before setCenter; setCenter corrects for zooms that go out of the map's bounds. The example on the site needs an update.

Yes that worked. Anyway, can't MM remember the center so that it is taken into account when setZoom() is called? IMHO you shouldn't need to know how it works, it should just work.

Thanks!

Contributor

tmcw commented Jun 19, 2012

Yes, been thinking about this issue; I don't think modestmaps should remember the center (and thus decouple the 'real center' and the 'intended center') but setCenter might not want to, by default, bound the values - the user should need to select 'restrictions' on the map.

/cc @springmeyer - no bright ideas on a solution here, but I was following the mapbox.js examples for workshop prep and hit, so keen on it working more intuitively.

@tmcw tmcw referenced this issue in mapbox/mapbox.js Oct 30, 2012

Closed

odd zooming behavior #128

Contributor

tmcw commented Jan 31, 2013

Fixed in the main modestmaps repo: f09f960

@tmcw tmcw closed this Jan 31, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment