mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-07-08 02:17:30 +08:00
fix(window): 修复迷你模式相关的两处状态污染
- 展开播放列表后的 340x400 迷你窗口被误判为普通窗口并持久化到 windowState,导致下次启动主窗口尺寸异常 - 迷你/主界面切换时复位 musicFull,避免残留 true 使返回后第一次点击 歌曲信息被取反关闭、全屏播放页'打不开' Closes #242
This commit is contained in:
@@ -381,8 +381,12 @@ class WindowSizeManager {
|
||||
}
|
||||
|
||||
// 检查是否是mini模式窗口(根据窗口大小判断)
|
||||
// 注意展开播放列表后的 mini 窗口是 340x400,也不能当普通窗口持久化,
|
||||
// 否则污染 windowState 导致下次启动主窗口尺寸异常(#242)
|
||||
const [currentWidth, currentHeight] = win.getSize();
|
||||
const isMiniMode = currentWidth === DEFAULT_MINI_WIDTH && currentHeight === DEFAULT_MINI_HEIGHT;
|
||||
const isMiniMode =
|
||||
currentWidth === DEFAULT_MINI_WIDTH &&
|
||||
(currentHeight === DEFAULT_MINI_HEIGHT || currentHeight === DEFAULT_MINI_EXPANDED_HEIGHT);
|
||||
|
||||
const isMaximized = win.isMaximized();
|
||||
let state: WindowState;
|
||||
|
||||
@@ -100,6 +100,10 @@ if (isElectron) {
|
||||
window.api.onLanguageChanged(handleSetLanguage);
|
||||
window.electron.ipcRenderer.on('mini-mode', (_, value) => {
|
||||
settingsStore.setMiniMode(value);
|
||||
// 切换迷你/主界面时复位全屏播放页状态:
|
||||
// musicFull 残留为 true 会让返回主界面后第一次点击歌曲信息被"取反"关闭,
|
||||
// 表现为全屏页打不开(#242)
|
||||
playerStore.setMusicFull(false);
|
||||
if (value) {
|
||||
// 存储当前路由
|
||||
localStorage.setItem('currentRoute', router.currentRoute.value.path);
|
||||
|
||||
Reference in New Issue
Block a user