Anadir swipe (deslizar derecha) para volver del servicio al calendario
This commit is contained in:
@@ -1118,6 +1118,38 @@
|
|||||||
setTimeout(() => modal.style.display = 'none', 300);
|
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)
|
// 🧾 PARTE DE TRABAJO (texto con IA + firma táctil + PDF + envío WhatsApp)
|
||||||
// ==========================================
|
// ==========================================
|
||||||
|
|||||||
Reference in New Issue
Block a user