fix(stage-tamagotchi): do not pause Live2D on visibility change (desktop switch) (#1410)

This commit is contained in:
Iro
2026-03-17 21:19:45 +08:00
committed by GitHub
parent 8648f761ed
commit ea599e8504
2 changed files with 5 additions and 2 deletions
@@ -21,7 +21,7 @@ describe('stage window lifecycle helpers', () => {
...createDefaultWindowLifecycleState(),
reason: 'hide',
visible: false,
})).toBe(true)
})).toBe(false)
expect(shouldPauseStageFromLifecycle({
...createDefaultWindowLifecycleState(),
@@ -18,7 +18,10 @@ export function createDefaultWindowLifecycleState(): ElectronWindowLifecycleStat
}
export function shouldPauseStageFromLifecycle(state: ElectronWindowLifecycleState) {
return !state.visible || state.minimized
// When the app window is moved to another virtual desktop on Windows, it may be treated as not visible
// by the platform even though we still need the stage to keep animating (for window capture usage).
// Only pause when minimized, and keep running for desktop-switch visibility changes.
return state.minimized
}
export const useStageWindowLifecycleStore = defineStore('stageWindowLifecycle', () => {