From: Tom Hughes Date: Wed, 21 Jul 2010 08:07:38 +0000 (+0100) Subject: Don't change the visibility of layers with no code X-Git-Tag: live~6317^2~11 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/ad116b243127bc37ea51d765c577de050b5ad33a?hp=53b0ace4c0577385af71394f03e2f4e2fb810f77 Don't change the visibility of layers with no code When parsing a layer state ignore any layers with no code attached rather than turning them off - this ensures that the marker layer remains enabled and any markers can be displayed. --- 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); } } }