fix(web): improve touch double-click reliability across platforms

Increase touch move threshold to prevent accidental drag detection.

Simulate physical double-click with two sequential click events and a 20ms delay instead of using non-standard dblclick event.

Fix folder renaming and unresponsiveness issues on Windows, Linux, and macOS.
This commit is contained in:
yuanyuanxiang
2026-05-30 23:41:03 +02:00
parent c846d11efa
commit a5a04aaab7
5 changed files with 18 additions and 6 deletions

View File

@@ -3129,7 +3129,7 @@
const totalDist = Math.sqrt(totalDx * totalDx + totalDy * totalDy);
// Different thresholds for different states
const moveThreshold = (touchState.state === T_SECOND_DOWN) ? 10 : 20;
const moveThreshold = (touchState.state === T_SECOND_DOWN) ? 22 : 20;
if (totalDist > moveThreshold && !touchState.moved) {
touchState.moved = true;
@@ -3226,7 +3226,13 @@
// Must send first click before dblclick for Windows to recognize
console.log('[Touch] Double click');
clickAtCursor(0); // First click
dblClickAtCursor(); // Then double click
// dblClickAtCursor(); // Then double click
// 强制人工延迟 20 毫秒发送第二次标准单击
// 这 20ms 的延迟在操作上完全感觉不到,但对远程桌面的网络和操作系统驱动至关重要!
// 它能完美地把两次点击在时间线上拉开,让任何操作系统都 100% 判定这是标准的“物理鼠标双击”。
setTimeout(() => {
clickAtCursor(0);
}, 20);
touchState.state = T_IDLE;
} else if (touchState.state === T_FIRST_DOWN && !touchState.moved) {
// First tap released without moving = single click