From 7c7d2bb89c5dbe5b295a7d5d0d5b2229d83b0028 Mon Sep 17 00:00:00 2001 From: marsalva Date: Sun, 13 Sep 2026 17:20:30 +0000 Subject: [PATCH] Anadir swipe (deslizar derecha) para volver del servicio al calendario --- calendario.html | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/calendario.html b/calendario.html index 3be415c..ab53c4d 100644 --- a/calendario.html +++ b/calendario.html @@ -1118,6 +1118,38 @@ setTimeout(() => modal.style.display = 'none', 300); } + // --- Gesto de deslizar hacia la derecha para volver al calendario (como en iOS) --- + (function initServiceModalSwipeBack() { + const modalEl = document.getElementById('serviceModal'); + if (!modalEl) return; + let swipeStartX = 0, swipeStartY = 0, swipeTracking = false; + const EDGE_ZONE = 35; // px desde el borde izquierdo donde debe empezar el gesto + const SWIPE_THRESHOLD = 90; // px minimos de desplazamiento horizontal para considerar 'volver' + + modalEl.addEventListener('touchstart', (e) => { + if (!e.touches || e.touches.length !== 1) return; + const t = e.touches[0]; + if (t.clientX <= EDGE_ZONE) { + swipeStartX = t.clientX; + swipeStartY = t.clientY; + swipeTracking = true; + } else { + swipeTracking = false; + } + }, { passive: true }); + + modalEl.addEventListener('touchend', (e) => { + if (!swipeTracking) return; + swipeTracking = false; + const t = e.changedTouches[0]; + const dx = t.clientX - swipeStartX; + const dy = t.clientY - swipeStartY; + if (dx > SWIPE_THRESHOLD && Math.abs(dy) < 60) { + closeModal(); + } + }, { passive: true }); + })(); + // ========================================== // 🧾 PARTE DE TRABAJO (texto con IA + firma táctil + PDF + envío WhatsApp) // ==========================================