Make sure the zoom level is valid when positioning the map. Closes #1158.
authorTom Hughes <tom@compton.nu>
Sat, 4 Oct 2008 23:44:41 +0000 (23:44 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 4 Oct 2008 23:44:41 +0000 (23:44 +0000)
public/javascripts/map.js

index cd130c784ff69fc93d12bced02c06156d5dab941..d6349d69887b8513e64ea9364d6325eb2a540f3d 100644 (file)
@@ -131,6 +131,8 @@ function getMapCenter(center, zoom) {
 }
 
 function setMapCenter(center, zoom) {
+   var numzoom = map.getNumZoomLevels();
+   if (zoom >= numzoom) zoom = numzoom - 1;
    map.setCenter(center.clone().transform(epsg4326, map.getProjectionObject()), zoom);
 }