Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Upgrading to 1.0.0

tmcw edited this page Apr 6, 2012 · 6 revisions

MM

Modest Maps by default is now accessible by MM, so there's no need to alias it in your code.

Layers

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)

TouchHandler by Default

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)

outerLimits -> tileLimits & coordLimits

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);

setSize

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.