Mobile fix for touch

This commit is contained in:
Alex Rennie-Lis
2026-06-29 01:06:45 +01:00
parent a208ffb45f
commit d3466d766f

View File

@@ -144,6 +144,7 @@
function handleMouseDown(e) { pointerDown(e.clientX, e.clientY, e.target); } function handleMouseDown(e) { pointerDown(e.clientX, e.clientY, e.target); }
function handleMouseMove(e) { pointerMove(e.clientX, e.clientY, () => e.preventDefault()); } function handleMouseMove(e) { pointerMove(e.clientX, e.clientY, () => e.preventDefault()); }
// Mobile Touch Panning Adapters
// Mobile Touch Panning Adapters // Mobile Touch Panning Adapters
function handleTouchStart(e) { function handleTouchStart(e) {
if (isZoomed) { if (isZoomed) {
@@ -155,7 +156,7 @@
} }
function handleTouchMove(e) { function handleTouchMove(e) {
if (isZoomed) { if (isZoomed && e.touches.length === 1) { // 👈 Ensures single finger panning behaves correctly
const touch = e.touches[0]; const touch = e.touches[0];
pointerMove(touch.clientX, touch.clientY, () => e.preventDefault()); pointerMove(touch.clientX, touch.clientY, () => e.preventDefault());
} }
@@ -217,7 +218,7 @@
onclick={(e) => { if (e.target === e.currentTarget) activePhoto = null; }} onclick={(e) => { if (e.target === e.currentTarget) activePhoto = null; }}
onkeydown={handleKeyDown} onkeydown={handleKeyDown}
ontouchstart={handleTouchStart} ontouchstart={handleTouchStart}
onttouchmove={handleTouchMove} ontouchmove={handleTouchMove}
ontouchend={handleTouchEnd} ontouchend={handleTouchEnd}
> >
<div class="w-full flex justify-between items-center z-50 p-2 pointer-events-none"> <div class="w-full flex justify-between items-center z-50 p-2 pointer-events-none">