changeset 234:8a14983244b0 gmap2

Some more work on filtering controls.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 15 Mar 2014 19:35:03 +0200
parents 1a89174b7152
children 0e6fa3f5684d
files markers.js
diffstat 1 files changed, 48 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/markers.js	Sat Mar 15 19:21:40 2014 +0200
+++ b/markers.js	Sat Mar 15 19:35:03 2014 +0200
@@ -345,13 +345,59 @@
 
 function pmapToggleVisContinent(c)
 {
-  pmapSetVisContinent(c, !markerVisStates[c]);
+  var first = true;
+  if (c == "all_c")
+    first = false;
+  else
+  {
+    for (var i = 0; i < pmapContinents.length; i++)
+    {
+      var q = pmapContinents[i][0];
+      if (!markerVisStates[q])
+      {
+        first = false;
+        break;
+      }
+    }
+  }
+
+  if (first)
+  {
+    pmapSetVisContinent("all_c", false);
+    pmapSetVisContinent(c, true);
+  }
+  else
+    pmapSetVisContinent(c, !markerVisStates[c]);
+
   pmapUpdateVisible();
 }
 
 
 function pmapToggleVisType(c)
 {
-  pmapSetVisType(c, !markerVisStates[c]);
+  var first = true;
+  if (c == "all_t")
+    first = false;
+  else
+  {
+    for (var i = 0; i < pmapMarkerTypes.length; i++)
+    {
+      var q = pmapMarkerTypes[i][1];
+      if (!markerVisStates[q])
+      {
+        first = false;
+        break;
+      }
+    }
+  }
+
+  if (first)
+  {
+    pmapSetVisType("all_t", false);
+    pmapSetVisType(c, true);
+  }
+  else
+    pmapSetVisType(c, !markerVisStates[c]);
+
   pmapUpdateVisible();
 }