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:
Arkadiusz Fal
2026-08-03 19:36:49 +02:00
parent 01cf9c953d
commit b0f573be82
3 changed files with 24 additions and 24 deletions

View File

@@ -125,7 +125,7 @@ struct ControlsSectionRenderer: View {
case .fullscreen:
if actions.shouldShowFullscreenButton {
controlButton(systemImage: actions.fullscreenIcon) {
handleFullscreenTap()
actions.performFullscreenTap()
}
.disabled(isLocked)
.opacity(isLocked ? 0.5 : 1.0)
@@ -818,26 +818,6 @@ struct ControlsSectionRenderer: View {
.animation(.easeInOut(duration: 0.2), value: isBrightnessExpanded)
}
// MARK: - Fullscreen Handling
private func handleFullscreenTap() {
let isActualWidescreenLayout = actions.isWideScreenLayout && actions.onTogglePanel != nil
if actions.isIPad {
// iPad: always toggle details visibility
actions.onToggleDetailsVisibility?()
} else if isActualWidescreenLayout && actions.isFullscreen && !actions.isWidescreenVideo {
// iPhone in landscape with portrait video fullscreen: rotate back to portrait
actions.onToggleFullscreen?()
} else if !actions.isWidescreenVideo {
// iPhone portrait video in portrait layout: toggle details visibility
actions.onToggleDetailsVisibility?()
} else {
// iPhone with widescreen video: rotate orientation
actions.onToggleFullscreen?()
}
}
// MARK: - Transport State
private var isTransportDisabled: Bool {