changeset 3054:1ef2f4179d30

client: map store: merged/renamed method(s)
author Markus Kottlaender <markus@intevation.de>
date Tue, 16 Apr 2019 09:00:42 +0200
parents 61e4feb04a35
children b3c24c47931c
files client/src/components/Bottlenecks.vue client/src/components/ImportStretches.vue client/src/components/fairway/Profiles.vue client/src/components/gauge/Gauges.vue client/src/components/importoverview/BottleneckDetail.vue client/src/components/importoverview/StretchDetails.vue client/src/store/fairway.js client/src/store/map.js
diffstat 8 files changed, 15 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Bottlenecks.vue	Tue Apr 16 08:42:09 2019 +0200
+++ b/client/src/components/Bottlenecks.vue	Tue Apr 16 09:00:42 2019 +0200
@@ -146,7 +146,7 @@
           this.$store.commit("bottlenecks/selectedSurvey", survey);
         })
         .then(() => {
-          this.$store.dispatch("map/moveToExtent", {
+          this.$store.dispatch("map/moveToFeauture", {
             feature: bottleneck,
             zoom: 17,
             preventZoomOut: true
@@ -163,7 +163,7 @@
           this.$store.commit("bottlenecks/setFirstSurveySelected");
         })
         .then(() => {
-          this.$store.dispatch("map/moveToExtent", {
+          this.$store.dispatch("map/moveToFeauture", {
             feature: bottleneck,
             zoom: 17,
             preventZoomOut: true
--- a/client/src/components/ImportStretches.vue	Tue Apr 16 08:42:09 2019 +0200
+++ b/client/src/components/ImportStretches.vue	Tue Apr 16 09:00:42 2019 +0200
@@ -460,7 +460,7 @@
     moveMapToStretch(stretch) {
       this.$store.commit("imports/selectedStretchId", stretch.id);
       this.openLayersMap.getLayer("STRETCHES").setVisible(true);
-      this.$store.dispatch("map/moveToExtent", {
+      this.$store.dispatch("map/moveToFeauture", {
         feature: stretch,
         zoom: 17,
         preventZoomOut: true
--- a/client/src/components/fairway/Profiles.vue	Tue Apr 16 08:42:09 2019 +0200
+++ b/client/src/components/fairway/Profiles.vue	Tue Apr 16 09:00:42 2019 +0200
@@ -570,7 +570,7 @@
         bn => bn.properties.name === this.selectedBottleneck
       );
       if (!bottleneck) return;
-      this.$store.dispatch("map/moveToExtent", {
+      this.$store.dispatch("map/moveToFeauture", {
         feature: bottleneck,
         zoom: 17,
         preventZoomOut: true
--- a/client/src/components/gauge/Gauges.vue	Tue Apr 16 08:42:09 2019 +0200
+++ b/client/src/components/gauge/Gauges.vue	Tue Apr 16 09:00:42 2019 +0200
@@ -180,7 +180,7 @@
     },
     moveToGauge() {
       if (!this.selectedGauge) return;
-      this.$store.dispatch("map/moveToExtent", {
+      this.$store.dispatch("map/moveToFeauture", {
         feature: this.selectedGauge,
         zoom: null,
         preventZoomOut: true
--- a/client/src/components/importoverview/BottleneckDetail.vue	Tue Apr 16 08:42:09 2019 +0200
+++ b/client/src/components/importoverview/BottleneckDetail.vue	Tue Apr 16 09:00:42 2019 +0200
@@ -148,7 +148,7 @@
     },
     moveToBottleneck(index) {
       this.openLayersMap.getLayer("BOTTLENECKS").setVisible(true);
-      this.$store.dispatch("map/moveToExtent", {
+      this.$store.dispatch("map/moveToFeauture", {
         feature: this.bottlenecks[index],
         zoom: 17,
         preventZoomOut: true
--- a/client/src/components/importoverview/StretchDetails.vue	Tue Apr 16 08:42:09 2019 +0200
+++ b/client/src/components/importoverview/StretchDetails.vue	Tue Apr 16 09:00:42 2019 +0200
@@ -42,7 +42,7 @@
         .then(response => {
           if (response.data.features.length < 1)
             throw new Error("no feaures found for: " + name);
-          this.$store.dispatch("map/moveToExtent", {
+          this.$store.dispatch("map/moveToFeauture", {
             feature: response.data.features[0],
             zoom: 17,
             preventZoomOut: true
--- a/client/src/store/fairway.js	Tue Apr 16 08:42:09 2019 +0200
+++ b/client/src/store/fairway.js	Tue Apr 16 09:00:42 2019 +0200
@@ -312,7 +312,7 @@
                       rootState.bottlenecks.selectedBottleneck
                   );
                   dispatch(
-                    "map/moveToExtent",
+                    "map/moveToFeauture",
                     {
                       feature: bottleneck,
                       zoom: 17,
--- a/client/src/store/map.js	Tue Apr 16 08:42:09 2019 +0200
+++ b/client/src/store/map.js	Tue Apr 16 09:00:42 2019 +0200
@@ -26,15 +26,6 @@
 import Feature from "ol/Feature";
 import Point from "ol/geom/Point";
 
-const moveMap = ({ view, extent, zoom, preventZoomOut }) => {
-  const currentZoom = view.getZoom();
-  zoom = zoom || currentZoom;
-  view.fit(extent, {
-    maxZoom: preventZoomOut ? Math.max(zoom, currentZoom) : zoom,
-    duration: 700
-  });
-};
-
 // initial state
 const init = () => {
   return {
@@ -414,9 +405,14 @@
     moveToBoundingBox({ getters }, { boundingBox, zoom, preventZoomOut }) {
       const extent = transformExtent(boundingBox, "EPSG:4326", "EPSG:3857");
       let view = getters.openLayersMap.getView();
-      moveMap({ view, extent, zoom, preventZoomOut });
+      const currentZoom = view.getZoom();
+      zoom = zoom || currentZoom;
+      view.fit(extent, {
+        maxZoom: preventZoomOut ? Math.max(zoom, currentZoom) : zoom,
+        duration: 700
+      });
     },
-    moveToExtent({ dispatch }, { feature, zoom, preventZoomOut }) {
+    moveToFeauture({ dispatch }, { feature, zoom, preventZoomOut }) {
       const boundingBox = bbox(feature.geometry);
       dispatch("moveToBoundingBox", { boundingBox, zoom, preventZoomOut });
     },