casi final

This commit is contained in:
David Itehua Xalamihua 2025-05-24 12:57:52 -06:00
parent 77abdef9ab
commit 5263520d5d
2 changed files with 10 additions and 49 deletions

View File

@ -26,7 +26,6 @@
</script> </script>
{% endblock body %} {% endblock body %}

View File

@ -24,6 +24,16 @@
} }
.floating-btn {
touch-action: none; /* Evita que el navegador maneje los eventos touch */
}
@media (hover: none) {
.floating-btn {
cursor: pointer; /* Cambia el cursor en dispositivos táctiles */
}
}
</style> </style>
<div class="floating-btn border border-light shadow-lg" id="floatingBtn"> <div class="floating-btn border border-light shadow-lg" id="floatingBtn">
@ -119,24 +129,6 @@
savePosition(x, y); savePosition(x, y);
} }
// function startTouch(e) {
// if (e.touches.length !== 1) return;
// hasMoved = false;
// const touch = e.touches[0];
// const startX = touch.clientX;
// const startY = touch.clientY;
// touchStartTimer = setTimeout(() => {
// // Si el temporizador termina y no ha habido movimiento, consideramos un tap
// link.click();
// }, tapThreshold);
// // Preparar para el movimiento
// const rect = btn.getBoundingClientRect();
// offsetX = startX - rect.left;
// offsetY = startY - rect.top;
// }
function startTouch(e) { function startTouch(e) {
if (e.touches.length !== 1) return; if (e.touches.length !== 1) return;
@ -158,26 +150,7 @@
}, tapThreshold); }, tapThreshold);
} }
// function moveTouch(e) {
// if (!touchStartTimer || e.touches.length !== 1) return;
// const touch = e.touches[0];
// const currentX = touch.clientX;
// const currentY = touch.clientY;
// // Verificar si el movimiento supera el umbral
// if (Math.abs(currentX - (touch.clientX - offsetX)) > moveThreshold || Math.abs(currentY - (touch.clientY - offsetY)) > moveThreshold) {
// clearTimeout(touchStartTimer); // Cancelar el temporizador si hay movimiento
// isDragging = true;
// hasMoved = true;
// btn.style.cursor = 'grabbing';
// btn.style.left = `${currentX - offsetX}px`;
// btn.style.top = `${currentY - offsetY}px`;
// btn.style.right = 'auto';
// e.preventDefault(); // Evitar el scroll durante el arrastre
// }
// }
function moveTouch(e) { function moveTouch(e) {
if (!touchStartTimer || e.touches.length !== 1 || !initialTouchX) return; if (!touchStartTimer || e.touches.length !== 1 || !initialTouchX) return;
@ -201,17 +174,6 @@
} }
} }
// function endTouch(e) {
// clearTimeout(touchStartTimer);
// if (isDragging) {
// isDragging = false;
// btn.style.cursor = 'move';
// const rect = btn.getBoundingClientRect();
// stickToNearestSide(rect.left, rect.top);
// savePosition(rect.left, rect.top);
// }
// }
function endTouch(e) { function endTouch(e) {