mirror of
https://github.com/yattee/yattee.git
synced 2024-11-09 15:58:20 +00:00
Change controls tap behavior
This commit is contained in:
parent
8ca499756a
commit
1d0615c9e1
@ -10,12 +10,13 @@ struct PlayerGestures: View {
|
|||||||
gestureRectangle
|
gestureRectangle
|
||||||
.tapRecognizer(
|
.tapRecognizer(
|
||||||
tapSensitivity: 0.2,
|
tapSensitivity: 0.2,
|
||||||
singleTapAction: { singleTapAction() },
|
|
||||||
doubleTapAction: {
|
doubleTapAction: {
|
||||||
|
model.presentingControls = false
|
||||||
let interval = TimeInterval(Defaults[.gestureBackwardSeekDuration]) ?? 10
|
let interval = TimeInterval(Defaults[.gestureBackwardSeekDuration]) ?? 10
|
||||||
player.backend.seek(relative: .secondsInDefaultTimescale(-interval), seekType: .userInteracted)
|
player.backend.seek(relative: .secondsInDefaultTimescale(-interval), seekType: .userInteracted)
|
||||||
},
|
},
|
||||||
anyTapAction: {
|
anyTapAction: {
|
||||||
|
singleTapAction()
|
||||||
model.update()
|
model.update()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -23,20 +24,22 @@ struct PlayerGestures: View {
|
|||||||
gestureRectangle
|
gestureRectangle
|
||||||
.tapRecognizer(
|
.tapRecognizer(
|
||||||
tapSensitivity: 0.2,
|
tapSensitivity: 0.2,
|
||||||
singleTapAction: { singleTapAction() },
|
|
||||||
doubleTapAction: {
|
doubleTapAction: {
|
||||||
|
model.presentingControls = false
|
||||||
player.backend.togglePlay()
|
player.backend.togglePlay()
|
||||||
}
|
},
|
||||||
|
anyTapAction: singleTapAction
|
||||||
)
|
)
|
||||||
|
|
||||||
gestureRectangle
|
gestureRectangle
|
||||||
.tapRecognizer(
|
.tapRecognizer(
|
||||||
tapSensitivity: 0.2,
|
tapSensitivity: 0.2,
|
||||||
singleTapAction: { singleTapAction() },
|
|
||||||
doubleTapAction: {
|
doubleTapAction: {
|
||||||
|
model.presentingControls = false
|
||||||
let interval = TimeInterval(Defaults[.gestureForwardSeekDuration]) ?? 10
|
let interval = TimeInterval(Defaults[.gestureForwardSeekDuration]) ?? 10
|
||||||
player.backend.seek(relative: .secondsInDefaultTimescale(interval), seekType: .userInteracted)
|
player.backend.seek(relative: .secondsInDefaultTimescale(interval), seekType: .userInteracted)
|
||||||
}
|
},
|
||||||
|
anyTapAction: singleTapAction
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,8 +53,8 @@ struct TapRecognizerViewModifier: ViewModifier {
|
|||||||
extension View {
|
extension View {
|
||||||
func tapRecognizer(
|
func tapRecognizer(
|
||||||
tapSensitivity: Double,
|
tapSensitivity: Double,
|
||||||
singleTapAction: @escaping () -> Void,
|
singleTapAction: @escaping () -> Void = {},
|
||||||
doubleTapAction: @escaping () -> Void,
|
doubleTapAction: @escaping () -> Void = {},
|
||||||
anyTapAction: @escaping () -> Void = {}
|
anyTapAction: @escaping () -> Void = {}
|
||||||
) -> some View {
|
) -> some View {
|
||||||
modifier(
|
modifier(
|
||||||
|
Loading…
Reference in New Issue
Block a user