Make sure the zoom level is valid when positioning the map. Closes #1158.
This commit is contained in:
parent
fe37259e01
commit
fb1d36623b
1 changed files with 2 additions and 0 deletions
|
@ -131,6 +131,8 @@ function getMapCenter(center, zoom) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setMapCenter(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);
|
map.setCenter(center.clone().transform(epsg4326, map.getProjectionObject()), zoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue