From e3a67347fd4256cb368dd5d5fbab40e920d9e1c5 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 2 Jan 2026 01:53:15 -0500 Subject: [PATCH] add touch swipe to overlay carousel --- src/components/Map/markerManager.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/components/Map/markerManager.js b/src/components/Map/markerManager.js index 3b85a53..ea18533 100644 --- a/src/components/Map/markerManager.js +++ b/src/components/Map/markerManager.js @@ -519,6 +519,20 @@ function initModalGallery(modalWrap, gallery) { }); }); setActive(0); + let touchStartX = 0; + const touchThreshold = 30; + heroImg.addEventListener("touchstart", (event) => { + if (!event.touches?.length) return; + touchStartX = event.touches[0].clientX; + }); + heroImg.addEventListener("touchend", (event) => { + if (!event.changedTouches?.length) return; + const dx = event.changedTouches[0].clientX - touchStartX; + if (Math.abs(dx) < touchThreshold) return; + const direction = dx > 0 ? -1 : 1; + const nextIndex = (activeIndex + direction + gallery.length) % gallery.length; + setActive(nextIndex); + }); } function openImageLightbox(src) {