Closed manelclos closed 11 years ago
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);
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!
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.
Fixed in the main modestmaps repo: f09f9605ebff123b5860bab682fae4f7572d949f
Version 1.0.0-alpha3 works correctly, version beta1 ignores latitude. Using setExtent() and setZoom() works as a workaround