X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/f6ac8ffbab8b9fee13bbcf7537cabb460eb40aae..3d1df30f6520be5c2d8998a688efba4700e3852d:/app/assets/javascripts/map.js.erb diff --git a/app/assets/javascripts/map.js.erb b/app/assets/javascripts/map.js.erb index 00aec6484..9df9ca2d9 100644 --- a/app/assets/javascripts/map.js.erb +++ b/app/assets/javascripts/map.js.erb @@ -78,7 +78,7 @@ var layers = [ ]; function createMap(divName, options) { - options = $.extend({zoomControl: false, panZoomControl: true, layerControl: true}, options); + options = $.extend({zoomControl: true, panZoomControl: true, layerControl: true}, options); map = L.map(divName, $.extend({}, options, {panControl: false, zoomsliderControl: false, maxZoom: 18})); @@ -184,11 +184,16 @@ function getMapLayers() { } function setMapLayers(layerConfig) { + var foundLayer = false; for (var i = 0; i < layers.length; i++) { if (layerConfig.indexOf(layers[i].layerCode) >= 0) { map.addLayer(layers[i].layer); + foundLayer = true; } else { map.removeLayer(layers[i].layer); } } + if (!foundLayer) { + map.addLayer(layers[0].layer); + } }