X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/53b0ace4c0577385af71394f03e2f4e2fb810f77..c5b35406a6236bc8ab993477214bacb303809169:/public/javascripts/map.js diff --git a/public/javascripts/map.js b/public/javascripts/map.js index 6fcfdf120..272913d20 100644 --- a/public/javascripts/map.js +++ b/public/javascripts/map.js @@ -260,15 +260,16 @@ function setMapLayers(layerConfig) { } } else { for (var i = 0; i < map.layers.length; i++) { - if (map.layers[i].layerCode && - layerConfig.indexOf(map.layers[i].layerCode) >= 0) { - if (map.layers[i].isBaseLayer) { - map.setBaseLayer(map.layers[i]); + if (map.layers[i].layerCode) { + if (layerConfig.indexOf(map.layers[i].layerCode) >= 0) { + if (map.layers[i].isBaseLayer) { + map.setBaseLayer(map.layers[i]); + } else { + map.layers[i].setVisibility(true); + } } else { - map.layers[i].setVisibility(true); + map.layers[i].setVisibility(false); } - } else { - map.layers[i].setVisibility(false); } } }