diff client/src/components/Maplayer.vue @ 2549:9bf6b767a56a

client: refactored and improved splitscreen for diagrams To make different diagrams possible, the splitscreen view needed to be decoupled from the cross profiles. Also the style has changed to make it more consistent with the rest of the app. The standard box header is now used and there are collapse and expand animations.
author Markus Kottlaender <markus@intevation.de>
date Fri, 08 Mar 2019 08:50:47 +0100
parents 89c439721db2
children 35f6e4383161
line wrap: on
line diff
--- a/client/src/components/Maplayer.vue	Thu Mar 07 20:03:43 2019 +0100
+++ b/client/src/components/Maplayer.vue	Fri Mar 08 08:50:47 2019 +0100
@@ -1,19 +1,22 @@
 <template>
-  <div id="map" :class="mapStyle"></div>
+  <div
+    id="map"
+    :class="{
+      splitscreen: this.splitscreen,
+      nocursor: this.hasActiveInteractions
+    }"
+  ></div>
 </template>
 
-<style lang="scss" scoped>
-.nocursor {
-  cursor: none;
-}
+<style lang="sass" scoped>
+#map
+  height: 100vh
 
-.mapsplit {
-  height: 50vh;
-}
+  &.splitscreen
+    height: 50vh
 
-.mapfull {
-  height: 100vh;
-}
+  &.nocursor
+    cursor: none
 </style>
 
 <script>
@@ -47,7 +50,8 @@
   name: "maplayer",
   data() {
     return {
-      projection: "EPSG:3857"
+      projection: "EPSG:3857",
+      splitscreen: false
     };
   },
   computed: {
@@ -63,13 +67,6 @@
     ]),
     ...mapState("bottlenecks", ["selectedSurvey"]),
     ...mapState("application", ["showSplitscreen"]),
-    mapStyle() {
-      return {
-        mapfull: !this.showSplitscreen,
-        mapsplit: this.showSplitscreen,
-        nocursor: this.hasActiveInteractions
-      };
-    },
     hasActiveInteractions() {
       return (
         (this.lineTool && this.lineTool.getActive()) ||
@@ -143,7 +140,16 @@
     }
   },
   watch: {
-    showSplitscreen() {
+    showSplitscreen(show) {
+      if (show) {
+        setTimeout(() => {
+          this.splitscreen = true;
+        }, 350);
+      } else {
+        this.splitscreen = false;
+      }
+    },
+    splitscreen() {
       const map = this.openLayersMap;
       this.$nextTick(() => {
         map && map.updateSize();