mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-08 15:43:42 +08:00
🐛 fix(window): 修复 Windows 恢复窗口后字体缩放异常
- 记录最小化和隐藏状态以识别任务栏恢复场景 - 恢复窗口时使用 restore 缩放修复路径校正 viewport drift - 增加任务栏恢复窗口缩放逻辑测试
This commit is contained in:
@@ -17,6 +17,12 @@ describe('windowStateUi', () => {
|
||||
expect(shouldApplyWindowsScaleFix('ratio-change', true)).toBe(true);
|
||||
});
|
||||
|
||||
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);
|
||||
expect(shouldToggleMaximisedWindowForScaleFix('restore', true)).toBe(true);
|
||||
});
|
||||
|
||||
it('debounces resize-triggered Windows scale checks until window transitions settle', () => {
|
||||
expect(resolveWindowsScaleCheckDelayMs('resize')).toBeGreaterThan(0);
|
||||
expect(resolveWindowsScaleCheckDelayMs('focus')).toBe(0);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
export type WindowVisualState = 'normal' | 'maximized' | 'fullscreen';
|
||||
export type WindowScaleFixReason = 'activation' | 'ratio-change';
|
||||
export type WindowScaleFixReason = 'activation' | 'ratio-change' | 'restore';
|
||||
export type WindowsScaleCheckTrigger = 'focus' | 'pageshow' | 'poll' | 'resize' | 'visibilitychange';
|
||||
export type TitleBarToggleIconKey = 'maximize' | 'restore';
|
||||
|
||||
export const shouldApplyWindowsScaleFix = (
|
||||
reason: WindowScaleFixReason,
|
||||
hasViewportScaleDrift: boolean,
|
||||
): boolean => reason === 'ratio-change' && hasViewportScaleDrift;
|
||||
): boolean => (reason === 'ratio-change' || reason === 'restore') && hasViewportScaleDrift;
|
||||
|
||||
export const shouldToggleMaximisedWindowForScaleFix = shouldApplyWindowsScaleFix;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user