modestmaps-js icon indicating copy to clipboard operation
modestmaps-js copied to clipboard

The example on http://modestmaps.com/ doesn't work now

Open jamierytlewski opened this issue 12 years ago • 2 comments

If I try and run the code:

map.setCenter({ lat: 51.55, lon: 0.1 }).setZoom(10);

It no longer works in the newest beta. This works:

map.setCenterZoom(new MM.Location(51.55, 0.1), 10);

Even the wiki on page https://github.com/stamen/modestmaps-js/wiki shows code like:

map.setCenter(new MM.Location(37.7749295, -122.4194155));
map.setCenterZoom(new MM.Location(37.7749295, -122.4194155), 11);
map.setZoom(11);

Which the middle line is duplicating what the 1st and 3rd lines do, but if you take out the 2nd line, the chaining doesn't work. It ends up putting the zoom somewhere that is not centered properly;

jamierytlewski avatar Apr 23 '12 14:04 jamierytlewski

Hi Jamie,

Zoom before you pan:

map.setZoom(10).setCenter({ lat: 51.55, lon: 0.1 });

As far as your wiki example; you're concatenating different examples, right? I don't see that code anywhere on the wiki as one segment.

tmcw avatar Apr 23 '12 15:04 tmcw

I made a change to the wiki example...I probably should've left it first. Of course, the website where you get the info from, has an older version (an alpha version) and the code if I was to copy/paste does not work.

jamierytlewski avatar Apr 23 '12 16:04 jamierytlewski