ContextUI: allow force touch activation

This commit is contained in:
Peter 2019-10-15 18:48:22 +04:00
parent 4543af75b3
commit b886b11664

View File

@ -139,19 +139,22 @@ public final class ContextGesture: UIGestureRecognizer, UIGestureRecognizerDeleg
super.touchesMoved(touches, with: event)
if let touch = touches.first {
/*if #available(iOS 9.0, *) {
if #available(iOS 9.0, *) {
let maxForce: CGFloat = max(2.5, min(3.0, touch.maximumPossibleForce))
let progress = touch.force / maxForce
self.currentProgress = progress
if self.isValidated {
self.activationProgress?(progress, .update)
}
if touch.force >= maxForce {
if !self.isValidated {
self.isValidated = true
}
switch self.state {
case .possible:
self.delayTimer?.invalidate()
self.animator?.invalidate()
self.activated?(self)
if let view = self.view?.superview {
if let window = view.window {
cancelOtherGestures(gesture: self, view: window)
}
cancelParentGestures(view: view)
}
self.state = .began
@ -159,7 +162,7 @@ public final class ContextGesture: UIGestureRecognizer, UIGestureRecognizerDeleg
break
}
}
}*/
}
self.externalUpdated?(self.view, touch.location(in: self.view))
}