X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/6baccfaddd190d730b626204e9cf81c2504995bf..17a7c69e8dfefb5dda2a9f57d6ea3c879d4568f4:/app/views/site/index.html.erb diff --git a/app/views/site/index.html.erb b/app/views/site/index.html.erb index 40a7a3fbc..0602b6f11 100644 --- a/app/views/site/index.html.erb +++ b/app/views/site/index.html.erb @@ -182,7 +182,7 @@ end function toggleData() { if (map.dataLayer.visibility) { <%= remote_function :url => { :controller => 'browse', :action => 'start' } %> - } else { + } else if (map.dataLayer.active) { closeSidebar(); } } @@ -191,10 +191,20 @@ end return getMapCenter(); } - function setPosition(lat, lon, zoom) { + function getZoom() { + return getMapZoom(); + } + + function setPosition(lat, lon, zoom, min_lon, min_lat, max_lon, max_lat) { var centre = new OpenLayers.LonLat(lon, lat); - setMapCenter(centre, zoom); + if (min_lon && min_lat && max_lon && max_lat) { + var bbox = new OpenLayers.Bounds(min_lon, min_lat, max_lon, max_lat); + + setMapExtent(bbox); + } else { + setMapCenter(centre, zoom); + } if (marker) removeMarkerFromMap(marker);