diff client/src/components/identify/Identify.vue @ 2747:fb5deecb77f1

client:identified box: implement the bbox zoom button
author Fadi Abbud <fadi.abbud@intevation.de>
date Wed, 20 Mar 2019 17:19:59 +0100
parents 4063adda3095
children d0f6c222f4f9
line wrap: on
line diff
--- a/client/src/components/identify/Identify.vue	Wed Mar 20 17:09:07 2019 +0100
+++ b/client/src/components/identify/Identify.vue	Wed Mar 20 17:19:59 2019 +0100
@@ -128,7 +128,7 @@
  */
 import { mapState, mapGetters } from "vuex";
 import { formatter } from "./formatter";
-import { displayInfo } from "@/lib/errors.js";
+import { getCenter } from "ol/extent";
 
 export default {
   name: "identify",
@@ -140,12 +140,16 @@
   },
   methods: {
     zoomTo(feature) {
-      displayInfo({
-        message:
-          "Coordinates:\n" +
-          JSON.stringify(feature.getProperties().bbox)
-            .split(",")
-            .join("\n")
+      this.$store.commit("map/moveMap", {
+        coordinates: getCenter(
+          feature
+            .getGeometry()
+            .clone()
+            .transform("EPSG:3857", "EPSG:4326")
+            .getExtent()
+        ),
+        zoom: 17,
+        preventZoomOut: true
       });
     },
     close() {