mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 11:20:18 +00:00
ContextUI: allow force touch activation
This commit is contained in:
parent
4543af75b3
commit
b886b11664
@ -139,19 +139,22 @@ public final class ContextGesture: UIGestureRecognizer, UIGestureRecognizerDeleg
|
|||||||
super.touchesMoved(touches, with: event)
|
super.touchesMoved(touches, with: event)
|
||||||
|
|
||||||
if let touch = touches.first {
|
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 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 touch.force >= maxForce {
|
||||||
|
if !self.isValidated {
|
||||||
|
self.isValidated = true
|
||||||
|
}
|
||||||
|
|
||||||
switch self.state {
|
switch self.state {
|
||||||
case .possible:
|
case .possible:
|
||||||
self.delayTimer?.invalidate()
|
self.delayTimer?.invalidate()
|
||||||
|
self.animator?.invalidate()
|
||||||
self.activated?(self)
|
self.activated?(self)
|
||||||
if let view = self.view?.superview {
|
if let view = self.view?.superview {
|
||||||
|
if let window = view.window {
|
||||||
|
cancelOtherGestures(gesture: self, view: window)
|
||||||
|
}
|
||||||
cancelParentGestures(view: view)
|
cancelParentGestures(view: view)
|
||||||
}
|
}
|
||||||
self.state = .began
|
self.state = .began
|
||||||
@ -159,7 +162,7 @@ public final class ContextGesture: UIGestureRecognizer, UIGestureRecognizerDeleg
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
self.externalUpdated?(self.view, touch.location(in: self.view))
|
self.externalUpdated?(self.view, touch.location(in: self.view))
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user