Make `GestureView` respond to double touch gesture (#1260)
This commit is contained in:
parent
c5d6539018
commit
071a1f98e1
|
@ -174,7 +174,7 @@ class UIGestureView: UIView {
|
||||||
|
|
||||||
let pinchGesture = UIPinchGestureRecognizer(target: self, action: #selector(didPerformPinch))
|
let pinchGesture = UIPinchGestureRecognizer(target: self, action: #selector(didPerformPinch))
|
||||||
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(didPerformTap))
|
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(didPerformTap))
|
||||||
let doubleTouchGesture = UITapGestureRecognizer(target: self, action: #selector(didPerformTap))
|
let doubleTouchGesture = UITapGestureRecognizer(target: self, action: #selector(didPerformDoubleTouch))
|
||||||
doubleTouchGesture.numberOfTouchesRequired = 2
|
doubleTouchGesture.numberOfTouchesRequired = 2
|
||||||
let longPressGesture = UILongPressGestureRecognizer(target: self, action: #selector(didPerformLongPress))
|
let longPressGesture = UILongPressGestureRecognizer(target: self, action: #selector(didPerformLongPress))
|
||||||
longPressGesture.minimumPressDuration = longPressMinimumDuration
|
longPressGesture.minimumPressDuration = longPressMinimumDuration
|
||||||
|
|
|
@ -376,6 +376,11 @@ extension VideoPlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func handleDoubleTouchGesture(unitPoint: UnitPoint, taps: Int) {
|
private func handleDoubleTouchGesture(unitPoint: UnitPoint, taps: Int) {
|
||||||
|
if doubleTouchGesture == .gestureLock {
|
||||||
|
guard !isPresentingOverlay else { return }
|
||||||
|
isGestureLocked.toggle()
|
||||||
|
}
|
||||||
|
|
||||||
guard !isGestureLocked else {
|
guard !isGestureLocked else {
|
||||||
updateViewProxy.present(systemName: "lock.fill", title: "Gestures Locked")
|
updateViewProxy.present(systemName: "lock.fill", title: "Gestures Locked")
|
||||||
return
|
return
|
||||||
|
@ -385,10 +390,15 @@ extension VideoPlayer {
|
||||||
case .none:
|
case .none:
|
||||||
return
|
return
|
||||||
case .aspectFill: ()
|
case .aspectFill: ()
|
||||||
case .gestureLock:
|
case .pausePlay:
|
||||||
guard !isPresentingOverlay else { return }
|
switch videoPlayerManager.state {
|
||||||
isGestureLocked.toggle()
|
case .playing:
|
||||||
case .pausePlay: ()
|
videoPlayerManager.proxy.pause()
|
||||||
|
default:
|
||||||
|
videoPlayerManager.proxy.play()
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue