Sync zoom changes from map with store

This commit is contained in:
Logan Williams
2023-05-03 10:07:44 +02:00
parent 2d7d22236f
commit bc362af618
2 changed files with 14 additions and 2 deletions

View File

@@ -32,8 +32,8 @@
<v-card style="width: 100%">
<v-card-title>Search area</v-card-title>
<l-map
:zoom="zoom"
:center="center"
:zoom.sync="zoom"
:center.sync="center"
style="width: 100%; height: 600px"
ref="map"
:noBlockingAnimations="true"
@@ -135,11 +135,17 @@ export default {
get() {
return this.$store.state.mapCenter;
},
set(val) {
this.$store.commit("setCenter", val);
},
},
zoom: {
get() {
return this.$store.state.mapZoom;
},
set(val) {
this.$store.commit("setZoom", val);
},
},
url() {
if (this.$store.state.mode == "google") {

View File

@@ -87,6 +87,12 @@ export default new Vuex.Store({
state.mapCenter = center;
state.mapZoom = zoom;
},
setZoom(state, zoom) {
state.mapZoom = zoom;
},
setCenter(state, center) {
state.mapCenter = center;
},
setResponseTime(state, t) {
state.responseTime = t;
},