mirror of
https://github.com/yattee/yattee.git
synced 2026-10-23 21:22:53 +00:00
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.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user