Mercurial > gemma
changeset 2713:b79f5c5404c2
client: made zoom optional in moveMap/moveToExtent
When selecting a gauge panning to the location is enough. Zoom shall remain the same.
So now, in these functions, you can specify zoom: null and no zooming will happen.
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Mon, 18 Mar 2019 17:47:16 +0100 |
parents | 0ac077897ce5 |
children | 4dd38840d74b |
files | client/src/components/gauge/Gauges.vue client/src/store/map.js |
diffstat | 2 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/gauge/Gauges.vue Mon Mar 18 17:37:24 2019 +0100 +++ b/client/src/components/gauge/Gauges.vue Mon Mar 18 17:47:16 2019 +0100 @@ -169,7 +169,7 @@ if (!this.selectedGauge) return; this.$store.commit("map/moveToExtent", { feature: this.selectedGauge, - zoom: 17, + zoom: null, preventZoomOut: true }); },
--- a/client/src/store/map.js Mon Mar 18 17:37:24 2019 +0100 +++ b/client/src/store/map.js Mon Mar 18 17:47:16 2019 +0100 @@ -55,6 +55,7 @@ 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 @@ -633,6 +634,7 @@ moveMap: (state, { coordinates, zoom, preventZoomOut }) => { let view = state.openLayersMap.getView(); const currentZoom = view.getZoom(); + zoom = zoom || currentZoom; view.animate({ zoom: preventZoomOut ? Math.max(zoom, currentZoom) : zoom, center: fromLonLat(coordinates, view.getProjection()), @@ -812,7 +814,7 @@ .transform("EPSG:3857", "EPSG:4326") .getExtent() ), - zoom: 17, + zoom: null, preventZoomOut: true }); }