-
Notifications
You must be signed in to change notification settings - Fork 72
Upgrading to 1.0.0
Modest Maps by default is now accessible by MM
, so there's no need to alias it in your code.
See Layers and Providers for the full new API.
The biggest change in Modest Maps 1.0.0 is that it supports layers where before we recommended people to stack maps on top of each other. This means that the code
map.setProvider(provider)
is now more like
map.setLayerAt(0, layer)
Before, if you wanted your Modest Maps map to support touch events, you needed to initialize it like
var map = new MM.Map('elem', provider, null, [ new MM.MouseHandler(), new MM.TouchHandler() ]);
This changes in 1.0.0 - the default value for the handlers is
var handlers = [ new MM.MouseHandler(), new MM.TouchHandler() ];
So it's not necessary to specify that you want a TouchHandler - it'll be there by default, and your maps will be compatible with multi-touch devices (currently Mobile Safari and Android post-ICS)
In 1.0.0, map navigation is decoupled from the tile availability code - you can set different limits for tiles to render and tiles to see.
In short, this means that maps have zoom levels you can restrict, and so do layers. It looks like
// prevent users from zooming beyond 10
map.setZoomRange(0, 10);
map.setSize()
turns map.autoSize = false
in 1.0.0. This prevents further auto-sizing of the map based on page or browser size changes.