From fd2df9f926a24b40fe5c73c57967cf2b20ada264 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Thu, 15 Sep 2022 15:54:21 +0800 Subject: [PATCH] Dont scroll the miniplayer when the user is scrubbing audio --- .../Sources/App/Views/AudioPlayer/MiniPlayer.swift | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/AudioPlayer/MiniPlayer.swift b/apple/OmnivoreKit/Sources/App/Views/AudioPlayer/MiniPlayer.swift index 5081ed0d1..37bb01a2a 100644 --- a/apple/OmnivoreKit/Sources/App/Views/AudioPlayer/MiniPlayer.swift +++ b/apple/OmnivoreKit/Sources/App/Views/AudioPlayer/MiniPlayer.swift @@ -402,15 +402,24 @@ public struct MiniPlayer: View { } } + var scrubbing: Bool { + switch audioController.scrubState { + case .scrubStarted: + return true + default: + return false + } + } + func onDragChanged(value: DragGesture.Value) { - if value.translation.height > 0, expanded { + if value.translation.height > 0, expanded, !scrubbing { offset = value.translation.height } } func onDragEnded(value: DragGesture.Value) { withAnimation(.interactiveSpring()) { - if value.translation.height > minExpandedHeight { + if value.translation.height > minExpandedHeight, !scrubbing { expanded = false } offset = 0