Mercurial > gemma
changeset 1159:f498494fceb5
zoom to bottleneck when clicked on map
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Tue, 13 Nov 2018 14:44:20 +0100 |
parents | da75faa8043f |
children | c8c26912754c e15850b3a9d1 |
files | client/src/application/Topbar.vue client/src/map/Maplayer.vue |
diffstat | 2 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/application/Topbar.vue Tue Nov 13 14:22:35 2018 +0100 +++ b/client/src/application/Topbar.vue Tue Nov 13 14:44:20 2018 +0100 @@ -215,7 +215,7 @@ if (resultEntry.type === "bottleneck") zoom = 17; if (resultEntry.type === "rhm") zoom = 15; if (resultEntry.type === "city") zoom = 13; - + this.$store.commit("map/moveMap", { coordinates: resultEntry.geom.coordinates, zoom,
--- a/client/src/map/Maplayer.vue Tue Nov 13 14:22:35 2018 +0100 +++ b/client/src/map/Maplayer.vue Tue Nov 13 14:44:20 2018 +0100 @@ -45,6 +45,7 @@ import { Map, View } from "ol"; import { WFS, GeoJSON } from "ol/format.js"; import { Stroke, Style, Fill } from "ol/style.js"; +import { getCenter } from "ol/extent"; /* for the sake of debugging */ /* eslint-disable no-console */ @@ -84,6 +85,17 @@ "bottlenecks/setSelectedBottleneck", feature.get("objnam") ); + this.$store.commit("map/moveMap", { + coordinates: getCenter( + feature + .getGeometry() + .clone() + .transform("EPSG:3857", "EPSG:4326") + .getExtent() + ), + zoom: 17, + preventZoomOut: true + }); } } }