Details panels in controls

This commit is contained in:
Arkadiusz Fal
2022-07-10 19:51:46 +02:00
parent db46289813
commit f0b8e7f655
15 changed files with 203 additions and 123 deletions

View File

@@ -9,17 +9,7 @@ struct PlayerGestures: View {
gestureRectangle
.tapRecognizer(
tapSensitivity: 0.2,
singleTapAction: {
if model.presentingControlsOverlay {
model.presentingControls = true
model.resetTimer()
withAnimation(PlayerControls.animation) {
model.presentingControlsOverlay = false
}
} else {
model.toggle()
}
},
singleTapAction: { singleTapAction() },
doubleTapAction: {
player.backend.seek(relative: .secondsInDefaultTimescale(-10))
},
@@ -31,17 +21,7 @@ struct PlayerGestures: View {
gestureRectangle
.tapRecognizer(
tapSensitivity: 0.2,
singleTapAction: {
if model.presentingControlsOverlay {
model.presentingControls = true
model.resetTimer()
withAnimation(PlayerControls.animation) {
model.presentingControlsOverlay = false
}
} else {
model.toggle()
}
},
singleTapAction: { singleTapAction() },
doubleTapAction: {
player.backend.togglePlay()
},
@@ -53,17 +33,7 @@ struct PlayerGestures: View {
gestureRectangle
.tapRecognizer(
tapSensitivity: 0.2,
singleTapAction: {
if model.presentingControlsOverlay {
model.presentingControls = true
model.resetTimer()
withAnimation(PlayerControls.animation) {
model.presentingControlsOverlay = false
}
} else {
model.toggle()
}
},
singleTapAction: { singleTapAction() },
doubleTapAction: {
player.backend.seek(relative: .secondsInDefaultTimescale(10))
},
@@ -74,6 +44,16 @@ struct PlayerGestures: View {
}
}
func singleTapAction() {
if model.presentingOverlays {
withAnimation(PlayerControls.animation) {
model.hideOverlays()
}
} else {
model.toggle()
}
}
var gestureRectangle: some View {
Color.clear
.contentShape(Rectangle())