From: Tom Hughes Date: Mon, 9 Sep 2013 17:30:27 +0000 (+0100) Subject: Make sure we always have a base layer X-Git-Tag: live~5294 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/366fb80ddb401fde376515dd12f51e281afe62da Make sure we always have a base layer --- diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index a19a6a61e..95771a4b2 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -53,14 +53,20 @@ $(document).ready(function () { function updateLayers(params) { var layerParam = params.layers || "M"; + var layersAdded = ""; for (var i = layers.length - 1; i >= 0; i--) { if (layerParam.indexOf(layers[i].options.code) >= 0) { map.addLayer(layers[i]); + layersAdded = layersAdded + layers[i].options.code; } else { map.removeLayer(layers[i]); } } + + if (layersAdded == "") { + map.addLayer(layers[0]); + } } updateLayers(params);