mirror of
https://github.com/yattee/yattee.git
synced 2026-07-21 06:42:01 +00:00
Open macOS inline player sheet at correct size when video is loaded
The inline-sheet content declared only a minWidth/minHeight floor, so .presentationSizing(.fitted) opened the sheet at 640x360 and SheetWindowResizer corrected it a runloop tick later — a visible small-then-resize flash when re-opening the sheet while a video plays. Feed the already-computed aspect-derived size as the frame's ideal size so .fitted opens the sheet at the correct size immediately when the video dimensions are known; the resizer's first pass then no-ops on its guard. The floor (no max) is kept so content still tracks later animated resizes.
This commit is contained in:
@@ -95,11 +95,17 @@ struct ContentView: View {
|
|||||||
)) {
|
)) {
|
||||||
let size = expandedSheetSize(appEnvironment: appEnvironment)
|
let size = expandedSheetSize(appEnvironment: appEnvironment)
|
||||||
ExpandedPlayerSheet()
|
ExpandedPlayerSheet()
|
||||||
// Only a floor — the content fills the sheet window so it tracks
|
// Floor keeps the content flexible so it tracks the window's
|
||||||
// the window's animated resize with no gap. Do NOT pin an exact
|
// animated resize with no gap — do NOT pin an exact (max) size:
|
||||||
// size here: a fixed frame snaps instantly while the window
|
// a fixed frame snaps instantly while the window animates,
|
||||||
// animates, exposing the window background as bars.
|
// exposing the window background as bars. The ideal size makes
|
||||||
.frame(minWidth: 640, minHeight: 360)
|
// `.presentationSizing(.fitted)` open the sheet at the correct
|
||||||
|
// aspect immediately when the video size is already known (e.g.
|
||||||
|
// re-opening while playing), avoiding a small-then-resize flash.
|
||||||
|
.frame(
|
||||||
|
minWidth: 640, idealWidth: size.width,
|
||||||
|
minHeight: 360, idealHeight: size.height
|
||||||
|
)
|
||||||
.presentationSizing(.fitted)
|
.presentationSizing(.fitted)
|
||||||
// `.presentationSizing(.fitted)` only fits the sheet once, at
|
// `.presentationSizing(.fitted)` only fits the sheet once, at
|
||||||
// presentation. Resize the backing window directly when the
|
// presentation. Resize the backing window directly when the
|
||||||
|
|||||||
Reference in New Issue
Block a user