mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-05-26 19:00:08 +08:00
🐛 fix(window): 避免 Windows 恢复窗口时重复最大化
- 恢复窗口场景不再触发最大化窗口切换修复 - 恢复期间 DPR 变化延迟到窗口状态稳定后处理 - 更新任务栏恢复窗口缩放策略测试
This commit is contained in:
@@ -738,6 +738,10 @@ function App() {
|
||||
return;
|
||||
}
|
||||
lastRatio = currentRatio;
|
||||
if (minimisedSeen || hiddenSeen) {
|
||||
scheduleActivationFix();
|
||||
return;
|
||||
}
|
||||
void fixWindowScaleIfNeeded('ratio-change');
|
||||
};
|
||||
|
||||
@@ -764,6 +768,7 @@ function App() {
|
||||
if (activationTimer !== null) {
|
||||
window.clearTimeout(activationTimer);
|
||||
}
|
||||
const delayMs = (minimisedSeen || hiddenSeen) ? 260 : 80;
|
||||
activationTimer = window.setTimeout(async () => {
|
||||
activationTimer = null;
|
||||
if (cancelled) return;
|
||||
@@ -774,7 +779,7 @@ function App() {
|
||||
minimisedSeen = false;
|
||||
hiddenSeen = false;
|
||||
void fixWindowScaleIfNeeded(reason);
|
||||
}, 80);
|
||||
}, delayMs);
|
||||
};
|
||||
|
||||
const handleWindowFocus = () => {
|
||||
|
||||
@@ -20,7 +20,7 @@ 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);
|
||||
expect(shouldToggleMaximisedWindowForScaleFix('restore', true)).toBe(true);
|
||||
expect(shouldToggleMaximisedWindowForScaleFix('restore', true)).toBe(false);
|
||||
});
|
||||
|
||||
it('debounces resize-triggered Windows scale checks until window transitions settle', () => {
|
||||
|
||||
@@ -8,7 +8,10 @@ export const shouldApplyWindowsScaleFix = (
|
||||
hasViewportScaleDrift: boolean,
|
||||
): boolean => (reason === 'ratio-change' || reason === 'restore') && hasViewportScaleDrift;
|
||||
|
||||
export const shouldToggleMaximisedWindowForScaleFix = shouldApplyWindowsScaleFix;
|
||||
export const shouldToggleMaximisedWindowForScaleFix = (
|
||||
reason: WindowScaleFixReason,
|
||||
hasViewportScaleDrift: boolean,
|
||||
): boolean => reason === 'ratio-change' && hasViewportScaleDrift;
|
||||
|
||||
export const resolveWindowsScaleCheckDelayMs = (trigger: WindowsScaleCheckTrigger): number =>
|
||||
trigger === 'resize' ? 240 : 0;
|
||||
|
||||
Reference in New Issue
Block a user