diff --git a/web/themes/custom/caravane/assets/js/main.js b/web/themes/custom/caravane/assets/js/main.js index 7c79709..13cfafd 100644 --- a/web/themes/custom/caravane/assets/js/main.js +++ b/web/themes/custom/caravane/assets/js/main.js @@ -39,8 +39,9 @@ import '../scss/main.scss' generalListLinks, logoLink, mapIcons, + mapContainer, } = processClickableElements(); - const clickableElements = [...etapeListLinks, ...generalListLinks, logoLink, ...mapIcons]; + const clickableElements = [...etapeListLinks, ...generalListLinks, logoLink, ...mapIcons, mapContainer]; setupMapStore(mapStore, map, settings); diff --git a/web/themes/custom/caravane/assets/js/stores/map.js b/web/themes/custom/caravane/assets/js/stores/map.js index e78b4e4..fb6b6be 100644 --- a/web/themes/custom/caravane/assets/js/stores/map.js +++ b/web/themes/custom/caravane/assets/js/stores/map.js @@ -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; diff --git a/web/themes/custom/caravane/assets/js/utils/handle-navigation.js b/web/themes/custom/caravane/assets/js/utils/handle-navigation.js index c012da0..0350e2f 100644 --- a/web/themes/custom/caravane/assets/js/utils/handle-navigation.js +++ b/web/themes/custom/caravane/assets/js/utils/handle-navigation.js @@ -23,11 +23,9 @@ export function handleClickableElements(clickableElements, store, router, baseUr if (href.startsWith(baseUrl)) href = href.replace(baseUrl, ''); link.onclick = async function (e) { - console.log('click on link, route push'); - - router.push(href); if (href !== window.location.pathname) { - pageChange(href, store, siteName, mapStore, baseUrl); + router.push(href); + pageChange(href, store, siteName, mapStore, baseUrl); } } } @@ -40,7 +38,6 @@ export async function handleBrowserNavigation(store, baseUrl, siteName, mapStore } export async function pageChange(href, store, siteName, mapStore, baseUrl) { - console.log('trigger page change'); if (href === '/') { store.resetStore(true); document.title = siteName; diff --git a/web/themes/custom/caravane/assets/js/utils/process-clickable-elements.js b/web/themes/custom/caravane/assets/js/utils/process-clickable-elements.js index 2ac11dd..afbe467 100644 --- a/web/themes/custom/caravane/assets/js/utils/process-clickable-elements.js +++ b/web/themes/custom/caravane/assets/js/utils/process-clickable-elements.js @@ -4,6 +4,7 @@ export function processClickableElements() { generalListLinks: processStaticLinks(), logoLink: processLogoLink(), mapIcons: processMapIcons(), + mapContainer: processMapContainer(), }; } @@ -64,3 +65,11 @@ function processMapIcons() { return icons; } + +function processMapContainer() { + let mapContainer = document.querySelector('.leaflet-layer'); + mapContainer.style.height = "100vh"; + mapContainer.style.width = "100vw"; + mapContainer.dataset.href = "/"; + return mapContainer; +} \ No newline at end of file diff --git a/web/themes/custom/caravane/assets/js/vuejs/components/ModaleFooter.vue b/web/themes/custom/caravane/assets/js/vuejs/components/ModaleFooter.vue index 988ef92..7672fef 100644 --- a/web/themes/custom/caravane/assets/js/vuejs/components/ModaleFooter.vue +++ b/web/themes/custom/caravane/assets/js/vuejs/components/ModaleFooter.vue @@ -6,11 +6,7 @@