changeset 4275:4f81082899c8

Legend: legend for bottlnecks isoline and differences should reload as well
author Thomas Junk <thomas.junk@intevation.de>
date Wed, 28 Aug 2019 16:09:19 +0200
parents e4ff09ebc2c3
children 3dbe05de54ea
files client/src/components/layers/Layerselect.vue
diffstat 1 files changed, 23 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/layers/Layerselect.vue	Wed Aug 28 15:54:46 2019 +0200
+++ b/client/src/components/layers/Layerselect.vue	Wed Aug 28 16:09:19 2019 +0200
@@ -56,7 +56,8 @@
     ...mapState("map", [
       "openLayersMaps",
       "isolinesLegendImgDataURL",
-      "differencesLegendImgDataURL"
+      "differencesLegendImgDataURL",
+      "ongoingRefresh"
     ]),
     ...mapGetters("map", ["openLayersMap"]),
     ...mapState("bottlenecks", ["selectedSurvey"]),
@@ -67,7 +68,27 @@
       return this.$gettext(this.layer.get("label"));
     }
   },
+  watch: {
+    ongoingRefresh() {
+      if (this.ongoingRefresh) return;
+      this.refreshLegend();
+    }
+  },
   methods: {
+    refreshLegend() {
+      if (this.layer.get("id") === "BOTTLENECKISOLINE") {
+        this.loadLegendImage(
+          "sounding_results_contour_lines_geoserver",
+          "isolinesLegendImgDataURL"
+        );
+      }
+      if (this.layer.get("id") === "DIFFERENCES") {
+        this.loadLegendImage(
+          "sounding_differences",
+          "differencesLegendImgDataURL"
+        );
+      }
+    },
     toggle(map) {
       if (map) {
         if (
@@ -141,18 +162,7 @@
     }
   },
   created() {
-    if (this.layer.get("id") === "BOTTLENECKISOLINE") {
-      this.loadLegendImage(
-        "sounding_results_contour_lines_geoserver",
-        "isolinesLegendImgDataURL"
-      );
-    }
-    if (this.layer.get("id") === "DIFFERENCES") {
-      this.loadLegendImage(
-        "sounding_differences",
-        "differencesLegendImgDataURL"
-      );
-    }
+    this.refreshLegend();
   }
 };
 </script>