dézoom map mobile
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { defineStore, mapStores } from 'pinia';
|
||||
|
||||
export const useLayoutStore = defineStore('layout', {
|
||||
state: () => ({
|
||||
|
@@ -4,7 +4,8 @@ import { useLayoutStore } from './layout';
|
||||
export const useMapStore = defineStore('mapState', {
|
||||
state: () => ({
|
||||
map: Object,
|
||||
defaultZoom: Number,
|
||||
defaultZoomDesktop: Number,
|
||||
defaultZoomMobile: Number,
|
||||
defaultMapCenter: Object,
|
||||
currentPlace: Object,
|
||||
maxZoom: Number,
|
||||
@@ -18,8 +19,8 @@ export const useMapStore = defineStore('mapState', {
|
||||
this.currentZoom = this.maxZoom;
|
||||
},
|
||||
resetMap() {
|
||||
this.map.flyTo(this.defaultMapCenter, this.defaultZoom, { duration: this.duration });
|
||||
this.currentZoom = this.defaultZoom;
|
||||
this.map.flyTo(this.defaultMapCenter, useLayoutStore().isDesktop ? this.defaultZoomDesktop : this.defaultZoomMobile, { duration: this.duration });
|
||||
this.currentZoom = useLayoutStore().isDesktop ? this.defaultZoomDesktop : this.defaultZoomMobile;
|
||||
},
|
||||
lockMap() {
|
||||
setTimeout(() => {
|
||||
@@ -35,7 +36,7 @@ export const useMapStore = defineStore('mapState', {
|
||||
// map.tap.disable();
|
||||
},
|
||||
unlockMap() {
|
||||
this.map.options.minZoom = this.defaultZoom;
|
||||
this.map.options.minZoom = useLayoutStore().isDesktop ? this.defaultZoomDesktop : this.defaultZoomMobile;
|
||||
this.map.options.maxZoom = this.maxZoom;
|
||||
this.map.dragging.enable();
|
||||
this.map.touchZoom.enable();
|
Reference in New Issue
Block a user