retour à l'index en cliquant sur la carte depuis une étape

This commit is contained in:
2025-03-03 22:42:55 +01:00
parent 6ecf055060
commit dffd179bc9
6 changed files with 34 additions and 42 deletions

View File

@@ -16,13 +16,14 @@ export const useMapStore = defineStore('mapState', {
animationDuration: 3,
}),
actions: {
zoomToPlace(lat, long) {
zoomToPlace(lat, long) {
if (useLayoutStore().isDesktop) long = long - 0.03;
this.map.flyTo(
[lat, long],
this.maxZoom,
{ animate: this.animationsAreEnabled, duration: this.animationDuration });
this.currentZoom = this.maxZoom;
this.lockMap();
},
resetMap(animate = this.animationsAreEnabled, duration = this.animationDuration) {
this.map.flyTo(
@@ -30,6 +31,7 @@ export const useMapStore = defineStore('mapState', {
useLayoutStore().isDesktop ? this.defaultZoomDesktop : this.defaultZoomMobile,
{ animate, duration });
this.currentZoom = useLayoutStore().isDesktop ? this.defaultZoomDesktop : this.defaultZoomMobile;
this.unlockMap();
},
lockMap() {
setTimeout(() => {
@@ -42,7 +44,7 @@ export const useMapStore = defineStore('mapState', {
this.map.scrollWheelZoom.disable();
this.map.boxZoom.disable();
this.map.keyboard.disable();
// map.tap.disable();
this.map._controlContainer.style.display = 'none';
},
unlockMap() {
this.map.options.minZoom = useLayoutStore().isDesktop ? this.defaultZoomDesktop : this.defaultZoomMobile;
@@ -53,7 +55,7 @@ export const useMapStore = defineStore('mapState', {
this.map.scrollWheelZoom.enable();
this.map.boxZoom.enable();
this.map.keyboard.enable();
// map.tap.enable();
this.map._controlContainer.style.display = 'block';
},
toggleAnimation() {
this.animationsAreEnabled = !this.animationsAreEnabled;