修复:聊天页左缘上滑滚动被抽屉手势误接管导致卡滞

bindEdgeSwipe 方向判定原用有符号比较 dy > dx:手指上滑时 dy 为负,
只要有几像素自然右偏就被误判为横向拉抽屉手势并 preventDefault,
整个拖动期间页面滚动被屏蔽(表现为左侧上滑卡滞、下滑正常、右侧无恙)。
改为绝对值主轴判定(dx>0 且 |dx|>|dy| 才接管),与设置页右滑返回逻辑一致。
This commit is contained in:
2026-09-08 09:52:10 +08:00
parent 08ba64c2b7
commit e187203630
+4 -1
View File
@@ -2571,7 +2571,10 @@
const dx = t.clientX - g.x0, dy = t.clientY - g.y0; const dx = t.clientX - g.x0, dy = t.clientY - g.y0;
if (!g.horiz) { if (!g.horiz) {
if (Math.abs(dx) < 8 && Math.abs(dy) < 8) return; // 方向未定,等待 if (Math.abs(dx) < 8 && Math.abs(dy) < 8) return; // 方向未定,等待
if (dy > dx || dx < 0) { g.cancelled = true; return; } // 纵向滚动或向左,放弃 // 纵向主导或向左:放弃接管。必须用绝对值比较:手指上滑时 dy 为负,
// 若用有符号的 dy > dx 判断,上滑+哪怕几像素的右偏(很常见的斜向拖动)
// 会被误判成横向手势并 preventDefault,导致左缘区域向上滚动被接管卡死。
if (dx <= 0 || Math.abs(dy) >= Math.abs(dx)) { g.cancelled = true; return; }
g.horiz = true; g.horiz = true;
} }
e.preventDefault(); // 手势归属抽屉:阻止页面滚动/系统返回 e.preventDefault(); // 手势归属抽屉:阻止页面滚动/系统返回