diff --git a/app/tabs/sessions/remote-desktop/RemoteDesktop.tsx b/app/tabs/sessions/remote-desktop/RemoteDesktop.tsx index 771fc9d..a32b202 100644 --- a/app/tabs/sessions/remote-desktop/RemoteDesktop.tsx +++ b/app/tabs/sessions/remote-desktop/RemoteDesktop.tsx @@ -314,6 +314,8 @@ export function RemoteDesktop({ host, isVisible, title }: RemoteDesktopProps) { // ── Single touch state ─────────────────────────────────────────────── let tpX = 0, tpY = 0, tpTime = 0, tpMoved = false; let tfTimer = null; + const TAP_MS = 350; + const TAP_MOVE_PX = 8; const dist2 = (e) => { const dx = e.touches[1].clientX - e.touches[0].clientX; @@ -412,13 +414,15 @@ export function RemoteDesktop({ host, isVisible, title }: RemoteDesktopProps) { if (e.touches.length !== 1) return; const tx = e.touches[0].clientX, ty = e.touches[0].clientY; - if (Math.abs(tx - tpX) > 4 || Math.abs(ty - tpY) > 4) tpMoved = true; + const moved = + Math.abs(tx - tpX) > TAP_MOVE_PX || + Math.abs(ty - tpY) > TAP_MOVE_PX; if (currentMode === 'touch') { // Single finger always drives the remote mouse (click+drag), even when zoomed. // The coordinate mapping (toRemote) already accounts for pan+zoom. sendMouseAt(tx, ty, false, false, false, false); - tpMoved = true; + if (moved) tpMoved = true; } else { // Trackpad: relative movement const rdx = (tx - tpX) * SENS * (remoteW / vpW()) / zoom; @@ -439,7 +443,7 @@ export function RemoteDesktop({ host, isVisible, title }: RemoteDesktopProps) { if (currentMode === 'touch') { // Tap (no movement, quick) = click - if (!tpMoved && dur < 250 && e.changedTouches.length === 1 && e.touches.length === 0) { + if (!tpMoved && dur < TAP_MS && e.changedTouches.length === 1 && e.touches.length === 0) { const tx = e.changedTouches[0].clientX, ty = e.changedTouches[0].clientY; sendMouseAt(tx, ty, true, false, false, false); setTimeout(() => sendMouseAt(tx, ty, false, false, false, false), 60); @@ -447,7 +451,7 @@ export function RemoteDesktop({ host, isVisible, title }: RemoteDesktopProps) { } else { // Trackpad if (e.touches.length === 0) { - if (!tpMoved && dur < 250 && e.changedTouches.length === 1) { + if (!tpMoved && dur < TAP_MS && e.changedTouches.length === 1) { sendMouseCursor(true, false); setTimeout(() => sendMouseCursor(false, false), 60); }