mirror of
https://github.com/yattee/yattee.git
synced 2024-12-14 06:10:32 +05:30
Player will close with swipe animation when threshold is reached
This commit is contained in:
parent
ec9fd25c25
commit
b3f835c040
@ -152,6 +152,10 @@ struct VideoPlayerView: View {
|
||||
.gesture(
|
||||
DragGesture(coordinateSpace: .global)
|
||||
.onChanged { value in
|
||||
guard player.presentingPlayer else {
|
||||
return // swiftlint:disable:this implicit_return
|
||||
}
|
||||
|
||||
player.backend.setNeedsDrawing(false)
|
||||
let drag = value.translation.height
|
||||
|
||||
@ -159,6 +163,11 @@ struct VideoPlayerView: View {
|
||||
return // swiftlint:disable:this implicit_return
|
||||
}
|
||||
|
||||
guard drag < 100 else {
|
||||
player.hide()
|
||||
return
|
||||
}
|
||||
|
||||
withAnimation(.easeInOut(duration: 0.2)) {
|
||||
viewVerticalOffset = drag
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user