mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-22 08:53:46 +08:00
🐛 fix(window): 用 CSS zoom nudge 修复任务栏恢复字体变大且不引入重复最大化
- 撤回上次错误的 toggle 改动:恢复 9848b8b2 的 restore 不重新最大化取舍,避免用户在任务栏点击恢复时看到窗口"被弹两次"
- 新增 applyWindowsViewportZoomNudge:通过短暂将 documentElement.style.zoom 设为 1.0001 并在两帧内重置,强制 Chromium 重算 layout metrics 修复字体变大,零可见动画、不动窗口
- maximised + drift + restore 路径从仅 dispatch resize 改为先 zoom nudge 再 dispatch resize
- 锁定 windowStateUi.test.ts 中 shouldToggleMaximisedWindowForScaleFix('restore', true)=false 取舍并补注释禁止再次反转
- windowsScaleFix.test.ts 加 jsdom 环境,新增双帧 zoom nudge 行为测试
This commit is contained in:
@@ -20,13 +20,10 @@ describe('windowStateUi', () => {
|
||||
it('applies the Windows scale fix when a minimized taskbar window is restored with viewport drift', () => {
|
||||
expect(shouldApplyWindowsScaleFix('restore', true)).toBe(true);
|
||||
expect(shouldApplyWindowsScaleFix('restore', false)).toBe(false);
|
||||
});
|
||||
|
||||
it('toggles maximised windows on restore so taskbar-restored fonts return to the correct size', () => {
|
||||
// maximised 状态下 OS 拒绝 SetSize nudge,唯一可行的修复是切一次 maximise;
|
||||
// 重复触发由 inFlight 互斥 + 700ms 冷却 + ratio-change 合并到 activationTimer 防御。
|
||||
expect(shouldToggleMaximisedWindowForScaleFix('restore', true)).toBe(true);
|
||||
expect(shouldToggleMaximisedWindowForScaleFix('restore', false)).toBe(false);
|
||||
// 关键:restore 场景刻意不再触发 maximised 窗口的 toggle —— Unmaximise → Maximise 在
|
||||
// 任务栏恢复的真实交互里会被用户肉眼看见为"重复最大化"动画,比偶发字体变大更糟。
|
||||
// 这是 9848b8b2 已有的取舍,禁止再次被"修复"成 true。
|
||||
expect(shouldToggleMaximisedWindowForScaleFix('restore', true)).toBe(false);
|
||||
});
|
||||
|
||||
it('debounces resize-triggered Windows scale checks until window transitions settle', () => {
|
||||
|
||||
Reference in New Issue
Block a user