Mercurial > gemma
changeset 3063:333aff79197d
client: maps: all map's views are now synced
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Tue, 16 Apr 2019 13:18:30 +0200 |
parents | 87e0422cffa7 |
children | c5d4cf89d323 |
files | client/src/components/map/Map.vue client/src/store/map.js |
diffstat | 2 files changed, 17 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/map/Map.vue Tue Apr 16 12:49:29 2019 +0200 +++ b/client/src/components/map/Map.vue Tue Apr 16 13:18:30 2019 +0200 @@ -58,13 +58,7 @@ }; }, computed: { - ...mapState("map", [ - "initialLoad", - "extent", - "lineTool", - "polygonTool", - "cutTool" - ]), + ...mapState("map", ["initialLoad", "extent", "syncedView"]), ...mapState("bottlenecks", ["selectedSurvey"]), ...mapState("application", ["showSplitscreen", "panes", "paneRotate"]), ...mapState("imports", ["selectedStretchId"]), @@ -147,16 +141,22 @@ } }, mounted() { + if (!this.syncedView) { + this.$store.commit( + "map/syncedView", + new View({ + center: [this.extent.lon, this.extent.lat], + minZoom: 5, // restrict zooming out to ~size of Europe for width 1000px + zoom: this.extent.zoom, + projection: "EPSG:3857" + }) + ); + } this.map = new Map({ layers: this.layers.config, target: "map-" + this.uuid, controls: [], - view: new View({ - center: [this.extent.lon, this.extent.lat], - minZoom: 5, // restrict zooming out to ~size of Europe for width 1000px - zoom: this.extent.zoom, - projection: "EPSG:3857" - }) + view: this.syncedView }); this.map.getLayer = id => this.layers.get(id);
--- a/client/src/store/map.js Tue Apr 16 12:49:29 2019 +0200 +++ b/client/src/store/map.js Tue Apr 16 13:18:30 2019 +0200 @@ -30,6 +30,7 @@ const init = () => { return { openLayersMaps: [], + syncedView: null, initialLoad: true, extent: { lat: 6155376, @@ -77,6 +78,9 @@ state.openLayersMaps.splice(index); } }, + syncedView: (state, view) => { + state.syncedView = view; + }, identifyToolEnabled: (state, enabled) => { state.identifyToolEnabled = enabled; },