From 0bf4f7e253daadddf83bc147d1cc089b96568b7e Mon Sep 17 00:00:00 2001 From: baiqing Date: Sun, 3 May 2026 15:04:36 +0800 Subject: [PATCH] =?UTF-8?q?fix(capsule):=20Windows=20=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=20host=20=E9=AB=98=E5=BA=A6=E8=B7=9F?= =?UTF-8?q?=E9=9A=8F=20translation=20flag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR Reviewer (PR Agent) 指出:getCapsuleHostMetrics(os, false) 把 translation 参数硬编码成 false,Windows 端 host 在翻译模式下应该从 84 长到 118,硬编码后徽章 bottom 用更短 host 量出来 → 跟 118pt 实际 窗口尺寸错位、徽章可能溢出或被裁。 修:把 useState 提到 hostMetrics 之前,调用改回 getCapsuleHostMetrics(os, translation)。macOS / Linux 不受影响 — capsuleLayout 在那两个分支已经忽略 translationActive 返回固定 42。 --- openless-all/app/src/components/Capsule.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openless-all/app/src/components/Capsule.tsx b/openless-all/app/src/components/Capsule.tsx index c81a7d39..618e4681 100644 --- a/openless-all/app/src/components/Capsule.tsx +++ b/openless-all/app/src/components/Capsule.tsx @@ -261,12 +261,13 @@ export function Capsule() { const { t } = useTranslation(); const os = detectOS(); const metrics = getCapsulePillMetrics(os); - const hostMetrics = getCapsuleHostMetrics(os, false); const [state, setState] = useState(isTauri ? 'idle' : 'recording'); const [level, setLevel] = useState(isTauri ? 0 : 0.6); const [insertedChars, setInsertedChars] = useState(0); const [message, setMessage] = useState(); const [translation, setTranslation] = useState(false); + // Windows 端 host 在翻译模式从 84 长到 118;macOS / Linux 上 capsuleLayout 已固定 42 忽略此参数。 + const hostMetrics = getCapsuleHostMetrics(os, translation); useEffect(() => { if (!isTauri) return;