mirror of
https://github.com/yattee/yattee.git
synced 2026-10-30 08:27:17 +00:00
Block the player dismiss pan from starting on side sliders
The window-level dismiss pan recognizes before SwiftUI's slider DragGesture sets isAdjustingPlayerSliders, so dragging volume or brightness often dismissed the player instead. Side sliders now publish their frames and the pan refuses to begin from touches inside them.
This commit is contained in:
@@ -175,6 +175,7 @@ private final class DragToDismissGestureHandler: NSObject, UIGestureRecognizerDe
|
||||
var getCornerBelowPanelFrame: (() -> CGRect)?
|
||||
/// Returns the panel resize grabber strip frame in screen coordinates (blocks dismiss pan)
|
||||
var getPanelResizeGrabberFrame: (() -> CGRect)?
|
||||
var getPlayerSideSliderFrames: (() -> [CGRect])?
|
||||
/// Returns whether the portrait panel is currently visible (not hidden off-screen)
|
||||
var isPortraitPanelVisible: (() -> Bool)?
|
||||
/// Returns the progress bar frame in screen coordinates (for gesture conflict resolution)
|
||||
@@ -383,6 +384,13 @@ private final class DragToDismissGestureHandler: NSObject, UIGestureRecognizerDe
|
||||
return false
|
||||
}
|
||||
|
||||
// ...or when the touch starts on a slider: the flag above is set by
|
||||
// SwiftUI's DragGesture, which fires after this pan recognizes
|
||||
let sliderTouch = panGesture.location(in: nil)
|
||||
if (getPlayerSideSliderFrames?() ?? []).contains(where: { $0.contains(sliderTouch) }) {
|
||||
return false
|
||||
}
|
||||
|
||||
// Don't begin dismiss gesture when dragging portrait panel
|
||||
if isPanelDragging?() == true {
|
||||
return false
|
||||
@@ -871,6 +879,9 @@ final class ExpandedPlayerWindowManager {
|
||||
handler.getPanelResizeGrabberFrame = { [weak self] in
|
||||
self?.appEnvironment?.navigationCoordinator.panelResizeGrabberFrame ?? .zero
|
||||
}
|
||||
handler.getPlayerSideSliderFrames = { [weak self] in
|
||||
self?.appEnvironment?.navigationCoordinator.playerSideSliderFrames.values.filter { !$0.isEmpty } ?? []
|
||||
}
|
||||
handler.isPortraitPanelVisible = { [weak self] in
|
||||
self?.appEnvironment?.navigationCoordinator.isPortraitPanelVisible ?? true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user