mirror of
https://github.com/yattee/yattee.git
synced 2025-01-06 01:20:31 +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(
|
.gesture(
|
||||||
DragGesture(coordinateSpace: .global)
|
DragGesture(coordinateSpace: .global)
|
||||||
.onChanged { value in
|
.onChanged { value in
|
||||||
|
guard player.presentingPlayer else {
|
||||||
|
return // swiftlint:disable:this implicit_return
|
||||||
|
}
|
||||||
|
|
||||||
player.backend.setNeedsDrawing(false)
|
player.backend.setNeedsDrawing(false)
|
||||||
let drag = value.translation.height
|
let drag = value.translation.height
|
||||||
|
|
||||||
@ -159,6 +163,11 @@ struct VideoPlayerView: View {
|
|||||||
return // swiftlint:disable:this implicit_return
|
return // swiftlint:disable:this implicit_return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guard drag < 100 else {
|
||||||
|
player.hide()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
withAnimation(.easeInOut(duration: 0.2)) {
|
withAnimation(.easeInOut(duration: 0.2)) {
|
||||||
viewVerticalOffset = drag
|
viewVerticalOffset = drag
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user