From eb7da0f0daf84171447b70fb97a97461c24c31e9 Mon Sep 17 00:00:00 2001 From: Dawn388887 Date: Sat, 5 Sep 2026 16:45:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=89=B9=E6=B3=A8=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=9D=A1=E9=BB=98=E8=AE=A4=E5=87=BA=E7=8E=B0=E5=9C=A8=E9=80=89?= =?UTF-8?q?=E5=8C=BA=E4=B8=8B=E6=96=B9=EF=BC=88below-first=EF=BC=89?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=BC=80=E5=8E=9F=E7=94=9F=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E9=81=AE=E6=8C=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原生选中菜单(移动端长按菜单、桌面 Edge/Chrome Copy/Search 浮层)锚定在 选区上沿附近,且原生 UI 恒绘制在页面内容之上,工具条放在上方必被遮挡, z-index 无法补救。placeAbove() 改为下方优先:下方放得下(bottom + 8 后仍 留 8px 边距)即放下方,否则回落上方并保留原有底部钳制。rect 与 window.innerHeight 同为布局视口坐标系,Android 地址栏伸缩时判断依然一致。 双端实测:Windows 11 桌面 Edge + Android 平板(联想 Y700)Edge, DSH 0.1.2-rc.1 + @changfenhuang/dsh-annotation 1.4.8。 --- client.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/client.js b/client.js index fd9dad7..d3b9466 100644 --- a/client.js +++ b/client.js @@ -722,8 +722,18 @@ window.__ModuleLoader__.load({ var w = 400 var left = rect.left + rect.width / 2 - w / 2 left = Math.max(8, Math.min(left, window.innerWidth - w - 8)) - var top = rect.top - height - 8 - if (top < 8) top = Math.min(rect.bottom + 8, window.innerHeight - height - 8) + // 下方优先:原生选中菜单(移动端长按菜单、桌面 Copy/Search 浮层)锚定在选区 + // 上沿附近,且原生 UI 恒绘制在页面内容之上(z-index 无效),工具条放上方必被 + // 遮挡;因此下方放得下就放下方,放不下才回上方。 + var belowTop = rect.bottom + 8 + var belowFits = belowTop + height <= window.innerHeight - 8 + var top + if (belowFits) { + top = belowTop + } else { + top = rect.top - height - 8 + if (top < 8) top = Math.min(rect.bottom + 8, window.innerHeight - height - 8) + } return { left: Math.round(left), top: Math.round(Math.max(8, top)) } }