mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Lock orientation button
This commit is contained in:
@@ -207,6 +207,7 @@ struct PlayerControls: View {
|
||||
|
||||
#if os(iOS)
|
||||
pipButton
|
||||
lockOrientationButton
|
||||
#endif
|
||||
|
||||
Spacer()
|
||||
@@ -262,6 +263,21 @@ struct PlayerControls: View {
|
||||
}
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
private var lockOrientationButton: some View {
|
||||
button("Lock Rotation", systemImage: player.lockedOrientation.isNil ? "lock.rotation.open" : "lock.rotation", active: !player.lockedOrientation.isNil) {
|
||||
if player.lockedOrientation.isNil {
|
||||
let orientationMask = OrientationTracker.shared.currentInterfaceOrientationMask
|
||||
player.lockedOrientation = orientationMask
|
||||
Orientation.lockOrientation(orientationMask)
|
||||
} else {
|
||||
player.lockedOrientation = nil
|
||||
Orientation.lockOrientation(.allButUpsideDown, andRotateTo: OrientationTracker.shared.currentInterfaceOrientation)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
var floatingControls: some View {
|
||||
HStack {
|
||||
HStack(spacing: 20) {
|
||||
|
Reference in New Issue
Block a user