Fix macOS corner layout window resize and re-lock the aspect ratio when panels hide

Entering the corner layout cleared the window's aspect-ratio lock by setting
contentAspectRatio to zero. That doesn't remove the constraint: AppKit keeps
its aspect-ratio resize handler active with a degenerate 0:0 ratio, so every
interactive resize resolved to the current size and the window couldn't be
resized at all. Reset contentResizeIncrements to 1x1 instead, the supported
way back to free resizing (aspect ratio and resize increments are mutually
exclusive).

Free resize now also requires the corner panels to be visible. With the
panels hidden only the video remains, so the window follows the ratio lock
(and auto-fit, when on) exactly like the stacked layout. The new
AppEnvironment.isCornerPanelLayoutActive gate covers the layout-change
handler, window creation, and the fullscreen-exit replay.
This commit is contained in:
Arkadiusz Fal
2026-09-28 20:19:10 +02:00
parent 14fe028ece
commit 99692a3554
2 changed files with 39 additions and 13 deletions

View File

@@ -875,9 +875,11 @@ private struct PlayerMacOSEventHandlersModifier: ViewModifier {
var playerState: PlayerState? { appEnvironment?.playerService.state }
/// Corner layout resizes the window freely: no aspect lock, no auto-fit.
/// Corner layout with its panels visible resizes the window freely: no
/// aspect lock, no auto-fit. With the panels hidden only the video is
/// left, so the window follows the ratio lock like the stacked layout.
private var isCornerLayoutActive: Bool {
appEnvironment?.navigationCoordinator.isCornerLayoutActive == true
appEnvironment?.isCornerPanelLayoutActive == true
}
func body(content: Content) -> some View {
@@ -895,7 +897,7 @@ private struct PlayerMacOSEventHandlersModifier: ViewModifier {
.onChange(of: playerState?.currentVideo?.id) { oldValue, newValue in
handleVideoChangeForResize(oldValue: oldValue, newValue: newValue)
}
.onChange(of: appEnvironment?.navigationCoordinator.isCornerLayoutActive) { _, isCorner in
.onChange(of: appEnvironment?.isCornerPanelLayoutActive) { _, isCorner in
handleCornerLayoutChange(isCorner: isCorner == true)
}
.onAppear {
@@ -903,9 +905,10 @@ private struct PlayerMacOSEventHandlersModifier: ViewModifier {
}
}
/// Entering corner mode drops the window's aspect-ratio constraint so it
/// resizes freely; leaving it restores the lock (and auto-fit, when on)
/// exactly as the aspect-change handler would have applied it.
/// Entering corner mode with panels shown drops the window's aspect-ratio
/// constraint so it resizes freely; leaving it (stacked layout, or corner
/// panels hidden) restores the lock (and auto-fit, when on) exactly as the
/// aspect-change handler would have applied it.
private func handleCornerLayoutChange(isCorner: Bool) {
if isCorner {
ExpandedPlayerWindowManager.shared.unlockAspectRatio()