mirror of
https://github.com/yattee/yattee.git
synced 2026-08-06 07:11:28 +00:00
Fix double-tap fullscreen gesture rotating on portrait videos
The fullscreen button routes through a portrait-video check (toggling the details panel instead of rotating), but the double-tap gesture called onToggleFullscreen directly and always rotated to landscape. Extract the shared decision into PlayerControlsActions.performFullscreenTap() and use it from both the button and the tap gesture handler.
This commit is contained in:
@@ -277,8 +277,28 @@ struct PlayerControlsActions {
|
||||
}
|
||||
}
|
||||
|
||||
/// Shared fullscreen-tap decision used by the fullscreen button and tap gestures.
|
||||
/// Keep in sync with `willRotateOnFullscreenToggle` (icon mirror of this logic).
|
||||
func performFullscreenTap() {
|
||||
let isActualWidescreenLayout = isWideScreenLayout && onTogglePanel != nil
|
||||
|
||||
if isIPad {
|
||||
// iPad: always toggle details visibility
|
||||
onToggleDetailsVisibility?()
|
||||
} else if isActualWidescreenLayout && isFullscreen && !isWidescreenVideo {
|
||||
// iPhone in landscape with portrait video fullscreen: rotate back to portrait
|
||||
onToggleFullscreen?()
|
||||
} else if !isWidescreenVideo {
|
||||
// iPhone portrait video in portrait layout: toggle details visibility
|
||||
onToggleDetailsVisibility?()
|
||||
} else {
|
||||
// iPhone with widescreen video: rotate orientation
|
||||
onToggleFullscreen?()
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether tapping fullscreen will cause device rotation.
|
||||
/// Mirrors the logic in ControlsSectionRenderer.handleFullscreenTap()
|
||||
/// Mirrors the logic in `performFullscreenTap()`
|
||||
var willRotateOnFullscreenToggle: Bool {
|
||||
// iPad never rotates via fullscreen button
|
||||
guard !isIPad else { return false }
|
||||
|
||||
Reference in New Issue
Block a user