From 66d7d5b944c6b9d427385c5ae5cfbc20936e4251 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Wed, 30 Sep 2026 23:18:36 +0200 Subject: [PATCH] Keep tabletop video in the upper half while dragging the panel The hidden video position was derived from the tabletop layout height, which only applies while the panel is hidden. Dragging the visible panel down therefore interpolated the video towards the full-screen center and it snapped back to the upper half once the hidden state flipped. Derive the hidden position from the hinge state directly so every drag, dismiss and reveal targets the upper-half center. --- .../Views/Player/ExpandedPlayerSheet+Layouts.swift | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Yattee/Views/Player/ExpandedPlayerSheet+Layouts.swift b/Yattee/Views/Player/ExpandedPlayerSheet+Layouts.swift index 6c480747..9632e3f2 100644 --- a/Yattee/Views/Player/ExpandedPlayerSheet+Layouts.swift +++ b/Yattee/Views/Player/ExpandedPlayerSheet+Layouts.swift @@ -270,7 +270,19 @@ extension ExpandedPlayerSheet { // top and bottom insets differ (the player window adds extra bottom // inset), so animating to screenHeight/2 and then flipping to the hidden // base position causes a visible jump of (bottom - top) / 2 points. - let hiddenVideoY = layoutHeight / 2 - safeAreaInsets.top + // + // Tabletop: the hidden position is the center of the upper half. This + // must follow the hinge, not `isTabletop` (which is false while the + // panel is visible): dragging the panel down interpolates the video + // towards this point, and using the full-screen center there moved + // the video down during the drag, only to snap it back up once the + // hidden state flipped to the half-height layout. + #if os(iOS) + let hiddenLayoutHeight = isTabletopHinge ? fullScreenHeight / 2 : fullScreenHeight + #else + let hiddenLayoutHeight = fullScreenHeight + #endif + let hiddenVideoY = hiddenLayoutHeight / 2 - safeAreaInsets.top let videoY: CGFloat = { if isPortraitPanelVisible {