X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/3792551f481dff6174eb7d5afeb86ae9b90d517a..ce53e510adb1baed6cc8f27e48d810a586853e55:/app/assets/javascripts/index.js?ds=sidebyside diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 029c0bfd1..2f0c16097 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -19,6 +19,8 @@ $(document).ready(function () { map.attributionControl.setPrefix(''); + new L.Hash(map); + var layers = [ new L.OSM.Mapnik({ attribution: '', @@ -98,24 +100,21 @@ $(document).ready(function () { map.markerLayer = L.layerGroup().addTo(map); if (!params.object_zoom) { - if (params.bbox) { - var bbox = L.latLngBounds([params.minlat, params.minlon], - [params.maxlat, params.maxlon]); - - map.fitBounds(bbox); - - if (params.box) { - L.rectangle(bbox, { - weight: 2, - color: '#e90', - fillOpacity: 0 - }).addTo(map); - } + if (params.bounds) { + map.fitBounds(params.bounds); } else { map.setView([params.lat, params.lon], params.zoom); } } + if (params.box) { + L.rectangle(params.box, { + weight: 2, + color: '#e90', + fillOpacity: 0 + }).addTo(map); + } + if (params.layers) { var foundLayer = false; for (var i = 0; i < layers.length; i++) {