From 5b72ad931bdce0bda24779dd631f493690329e97 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Fri, 2 Sep 2022 01:05:54 +0200 Subject: [PATCH] Improve rotation --- Model/Player/PlayerModel.swift | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Model/Player/PlayerModel.swift b/Model/Player/PlayerModel.swift index 3b36584c..374cef1c 100644 --- a/Model/Player/PlayerModel.swift +++ b/Model/Player/PlayerModel.swift @@ -889,13 +889,24 @@ final class PlayerModel: ObservableObject { Windows.player.toggleFullScreen() #endif - playingFullScreen = !isFullScreen - #if os(iOS) if !playingFullScreen { + playingFullScreen = true + Orientation.lockOrientation(.allButUpsideDown, andRotateTo: OrientationTracker.shared.currentInterfaceOrientation) + } else { let rotationOrientation = rotateToPortraitOnExitFullScreen ? UIInterfaceOrientation.portrait : nil Orientation.lockOrientation(.allButUpsideDown, andRotateTo: rotationOrientation) + // TODO: rework to move view before rotating + if SafeArea.insets.left > 0 { + Delay.by(0.15) { + self.playingFullScreen = false + } + } else { + self.playingFullScreen = false + } } + #else + playingFullScreen = !isFullScreen #endif }