# HG changeset patch # User Markus Kottlaender # Date 1552927636 -3600 # Node ID b79f5c5404c235161f0462508850513d70830c02 # Parent 0ac077897ce5531958bbc1e1d2c6bbbc6761b9c8 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. diff -r 0ac077897ce5 -r b79f5c5404c2 client/src/components/gauge/Gauges.vue --- 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 }); }, diff -r 0ac077897ce5 -r b79f5c5404c2 client/src/store/map.js --- 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 }); }