mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-05-19 03:57:28 +08:00
fix: 修复mini窗口恢复时导致的应用窗口变小问题
This commit is contained in:
@@ -31,6 +31,8 @@ export interface WindowState {
|
||||
isMaximized: boolean;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 窗口大小管理器
|
||||
* 负责保存、恢复和维护窗口大小状态
|
||||
@@ -338,6 +340,10 @@ class WindowSizeManager {
|
||||
};
|
||||
}
|
||||
|
||||
// 检查是否是mini模式窗口(根据窗口大小判断)
|
||||
const [currentWidth, currentHeight] = win.getSize();
|
||||
const isMiniMode = currentWidth === DEFAULT_MINI_WIDTH && currentHeight === DEFAULT_MINI_HEIGHT;
|
||||
|
||||
const isMaximized = win.isMaximized();
|
||||
let state: WindowState;
|
||||
|
||||
@@ -384,6 +390,12 @@ class WindowSizeManager {
|
||||
console.log('state IsNormal',state)
|
||||
}
|
||||
|
||||
// 如果是mini模式,不保存到持久化存储,只返回状态用于内存中的恢复
|
||||
if (isMiniMode) {
|
||||
console.log('检测到mini模式窗口,不保存到持久化存储');
|
||||
return state;
|
||||
}
|
||||
|
||||
// 保存状态到存储
|
||||
this.store.set(WINDOW_STATE_KEY, state);
|
||||
console.log(`已保存窗口状态: ${JSON.stringify(state)}`);
|
||||
@@ -420,6 +432,8 @@ class WindowSizeManager {
|
||||
return validatedState;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 检查位置是否在可见屏幕范围内
|
||||
*/
|
||||
@@ -698,3 +712,4 @@ export const initWindowSizeHandlers = (mainWindow: BrowserWindow | null): void =
|
||||
export const calculateMinimumWindowSize = (): { minWidth: number; minHeight: number } => {
|
||||
return { minWidth: MIN_WIDTH, minHeight: MIN_HEIGHT };
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user