changeset 5482:89b6978afc58

Client:FWA: Fix Legend of AFDvsLNWL
author Fadi Abbud <fadi.abbud@intevation.de>
date Fri, 20 Aug 2021 10:18:43 +0200
parents 38640b20360d
children e8dc7a7aec41
files client/src/components/fairway/AvailableFairwayDepth.vue client/src/components/fairway/AvailableFairwayDepthLNWL.vue
diffstat 2 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/fairway/AvailableFairwayDepth.vue	Thu Aug 19 22:12:59 2021 +0200
+++ b/client/src/components/fairway/AvailableFairwayDepth.vue	Fri Aug 20 10:18:43 2021 +0200
@@ -444,7 +444,10 @@
       }
     },
     legendStyle(index) {
-      if (this.depthlimit1 === this.depthlimit2) {
+      if (
+        (this.depthlimit1 && this.depthlimit1 === this.depthlimit2) ||
+        (this.widthlimit1 && this.widthlimit1 === this.widthlimit2)
+      ) {
         let result = [
           `background-color: ${this.$options.COLORS.LDC};`,
           `background-color: ${this.$options.COLORS.HIGHEST};`
--- a/client/src/components/fairway/AvailableFairwayDepthLNWL.vue	Thu Aug 19 22:12:59 2021 +0200
+++ b/client/src/components/fairway/AvailableFairwayDepthLNWL.vue	Fri Aug 20 10:18:43 2021 +0200
@@ -192,12 +192,15 @@
       "widthlimit2"
     ]),
     legendLNWL() {
-      const d = [this.depthlimit1D, this.depthlimit2D].sort();
-      const w = [this.widthlimit1D, this.widthlimit2D].sort();
+      const d = [this.depthlimit1D, this.depthlimit2D].sort((a, b) => a - b);
+      const w = [this.widthlimit1D, this.widthlimit2D].sort((a, b) => a - b);
       const lowerBound = [d[0] / 100, w[0]].filter(x => x).join(", ");
       const upperBound = [d[1] / 100, w[1]].filter(x => x).join(", ");
       let result;
-      if (this.depthlimit1D !== this.depthlimit2D) {
+      if (
+        this.depthlimit1D !== this.depthlimit2D ||
+        this.widthlimit1 !== this.widthlimit2
+      ) {
         result = [
           `> LDC`,
           `< ${lowerBound} [m]`,
@@ -325,7 +328,10 @@
     },
     legendStyle(index) {
       let style;
-      if (this.depthlimit1 !== this.depthlimit2) {
+      if (
+        this.depthlimit1 !== this.depthlimit2 ||
+        this.widthlimit1 !== this.widthlimit2
+      ) {
         style = {
           0: `background-color: ${this.$options.LWNLCOLORS.LDC};`,
           1: `background-color: ${this.$options.AFDCOLORS[2]};`,