Each map has a number of zoom levels, referenced by an index number (ranging from 0 to 19, inclusive). The zoom level of a map is controlled using one of three functions: zoomIn(), zoomOut() and setZoomIndex().

The zoomIn() and zoomOut() functions incrementally increase (or decrease) the map’s zoom level each time the function is called.

map.zoomIn(); // zoom in one zoom level

The setZoomIndex() function zooms the map straight to a specified zoom level. You can use the getMinZoomIndex() and getMaxZoomIndex() functions to determine the minimum and maximum zoom levels available for a given map. For example:

map.setZoomIndex(16); // neighborhood view...
map.setZoomIndex(map.getMinZoomIndex()); // ...world view

 

Published, Jun 28th 2010, 15:36

Tagged under: javascript maps