From f27f46099c3f45af2e5747ccf6fe484b82bcfe2f Mon Sep 17 00:00:00 2001 From: HomeDash Bot Date: Sat, 12 Sep 2026 21:59:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(ui):=20=E4=BF=AE=E6=AD=A3=E6=BB=91=E5=8A=A8?= =?UTF-8?q?=E6=89=8B=E5=8A=BF=E7=9A=84=E4=B8=A4=E4=B8=AA=E7=A1=AE=E5=87=BF?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=EF=BC=88=E8=A7=A6=E5=B1=8F=E4=B8=8D=E5=88=87?= =?UTF-8?q?=E6=8D=A2=20/=20=E8=A7=A6=E6=8E=A7=E6=9D=BF=E6=96=B9=E5=90=91?= =?UTF-8?q?=E5=8F=8D=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v89 实测 12/16,且已测出事件确实到达(触摸 touch+pointer 各 7 个、wheel deltaX=40 共 4 次), 证明不是"事件没到",而是逻辑把结果吃掉了: ① 防误触拦截器把自己吞了:滑动后 400ms 内抑制 click(防误开卡片), 而切换手势发的正是 tabs[j].click() → 被自己拦掉 → 表现为"滑了没反应"。 修法:程序化切换 click 期间置 swipeSelfClick 放行,并清掉本次抑制窗口。 ② 触控板方向反了:两指向左滑时浏览器给 deltaX > 0(内容右移), 原实现映射成"上一个",在第一个分组会被 clamp → 看起来完全没反应。 修法:deltaX > 0 → 下一个分组。 --- web/navi.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/web/navi.js b/web/navi.js index 3d4b091..440fd2d 100644 --- a/web/navi.js +++ b/web/navi.js @@ -629,6 +629,7 @@ let swipeEl = null; // 已绑定手势的 .minimal-home(元素重建时重绑) let swipeDocBound = false; // document 级监听只装一次 let swipeBusy = false, swipeAcc = 0, swipeAccAt = 0, swipeCoolUntil = 0, swipeEatClick = 0; + let swipeSelfClick = false; // 我们自己的切换 click 不能被自己的防误触拦掉 function swipeTabs() { return Array.from(document.querySelectorAll('.minimal-headings-row > .minimal-section-heading.headings')); @@ -687,7 +688,11 @@ frame.style.opacity = '0.28'; await later(90); } - tabs[j].click(); + // 关键:这是我们自己发起的切换 click —— 必须绕开"防误触"拦截, + // 否则会出现"手势收到了、手势条件也满足,但页面没切"的怪象(实测踩过)。 + swipeEatClick = 0; + swipeSelfClick = true; + try { tabs[j].click(); } finally { swipeSelfClick = false; } await later(70); if (fade) { frame.style.transition = 'opacity 150ms ease'; @@ -752,7 +757,8 @@ swipeAccAt = now; swipeAcc += evt.deltaX; if (Math.abs(swipeAcc) >= SWIPE.wheelShown && !swipeBusy && now >= swipeCoolUntil) { - const dir = swipeAcc < 0 ? 1 : -1; + // 方向语义实测:两指向左滑 → 浏览器给 deltaX > 0 → 应是"下一个分组" + const dir = swipeAcc > 0 ? 1 : -1; swipeAcc = 0; swipeSwitch(dir); } @@ -762,6 +768,7 @@ swipeDocBound = true; // 滑动后吞掉紧随的一次 click,避免误开卡片里的链接 document.addEventListener('click', (evt) => { + if (swipeSelfClick) return; // 放行我们自己的切换 click if (Date.now() < swipeEatClick) { swipeEatClick = 0; evt.preventDefault();