]> git.openstreetmap.org Git - rails.git/commitdiff
Don't change the visibility of layers with no code
authorTom Hughes <tom@compton.nu>
Wed, 21 Jul 2010 08:07:38 +0000 (09:07 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 21 Jul 2010 08:07:38 +0000 (09:07 +0100)
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.

public/javascripts/map.js

index 6fcfdf120cd0fdafae0e7aee9774cbe31b97916f..272913d203c2ae8462888ff84ae1e85b748d2f7e 100644 (file)
@@ -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);
          }
       }
    }