X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/30ad58c01ff8acae377cfd974fcc94d6898722da..19bac47e5f282ccd532fc29a68faa04928c72353:/app/assets/javascripts/map.js.erb diff --git a/app/assets/javascripts/map.js.erb b/app/assets/javascripts/map.js.erb index eae9b8952..2e72046d1 100644 --- a/app/assets/javascripts/map.js.erb +++ b/app/assets/javascripts/map.js.erb @@ -76,12 +76,18 @@ var layers = [ } ]; -function createMap(divName) { - map = L.map(divName); +function createMap(divName, options) { + map = L.map(divName, options); - map.attributionControl.setPrefix(''); // For tmcw + if (map.attributionControl) { + map.attributionControl.setPrefix(''); // For tmcw + } + + var layersControl = L.control.layers(); - var layersControl = L.control.layers().addTo(map); + if (!options || options.layerControl !== false) { + layersControl.addTo(map); + } for (var i = 0; i < layers.length; i++) { layers[i].layer = L.tileLayer(layers[i].urlTemplate, layers[i]);