mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 13:35:19 +00:00
Check idea from be6bc8845d
This commit is contained in:
parent
20ec0b6e05
commit
40b19cfef2
@ -1038,7 +1038,19 @@ private class ReorderingGestureRecognizerTimerTarget: NSObject {
|
||||
}
|
||||
}
|
||||
|
||||
private final class InternalGestureRecognizerDelegate: NSObject, UIGestureRecognizerDelegate {
|
||||
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
if otherGestureRecognizer is UIPanGestureRecognizer {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final class ReorderingGestureRecognizer: UIGestureRecognizer, UIGestureRecognizerDelegate {
|
||||
private let internalDelegate = InternalGestureRecognizerDelegate()
|
||||
|
||||
private let shouldBegin: (CGPoint) -> Bool
|
||||
private let began: (CGPoint) -> Void
|
||||
private let ended: () -> Void
|
||||
@ -1057,7 +1069,7 @@ private final class ReorderingGestureRecognizer: UIGestureRecognizer, UIGestureR
|
||||
|
||||
super.init(target: nil, action: nil)
|
||||
|
||||
self.delegate = self
|
||||
self.delegate = self.internalDelegate
|
||||
}
|
||||
|
||||
override func reset() {
|
||||
@ -1069,14 +1081,6 @@ private final class ReorderingGestureRecognizer: UIGestureRecognizer, UIGestureR
|
||||
self.currentLocation = nil
|
||||
}
|
||||
|
||||
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
if otherGestureRecognizer is UIPanGestureRecognizer {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent) {
|
||||
super.touchesBegan(touches, with: event)
|
||||
|
||||
|
@ -62,7 +62,18 @@ private func cancelOtherGestures(gesture: ContextGesture, view: UIView) {
|
||||
}
|
||||
}
|
||||
|
||||
private final class InternalGestureRecognizerDelegate: NSObject, UIGestureRecognizerDelegate {
|
||||
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
if otherGestureRecognizer is UIPanGestureRecognizer {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
public final class ContextGesture: UIGestureRecognizer, UIGestureRecognizerDelegate {
|
||||
private let internalDelegate = InternalGestureRecognizerDelegate()
|
||||
|
||||
public var beginDelay: Double = 0.12
|
||||
public var activateOnTap: Bool = false
|
||||
private var currentProgress: CGFloat = 0.0
|
||||
@ -82,7 +93,7 @@ public final class ContextGesture: UIGestureRecognizer, UIGestureRecognizerDeleg
|
||||
override public init(target: Any?, action: Selector?) {
|
||||
super.init(target: target, action: action)
|
||||
|
||||
self.delegate = self
|
||||
self.delegate = self.internalDelegate
|
||||
}
|
||||
|
||||
override public func reset() {
|
||||
@ -101,13 +112,6 @@ public final class ContextGesture: UIGestureRecognizer, UIGestureRecognizerDeleg
|
||||
self.wasActivated = false
|
||||
}
|
||||
|
||||
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
if otherGestureRecognizer is UIPanGestureRecognizer {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override public func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent) {
|
||||
super.touchesBegan(touches, with: event)
|
||||
|
||||
|
@ -72,7 +72,18 @@ public enum TapLongTapOrDoubleTapGestureRecognizerAction {
|
||||
case keepWithSingleTap
|
||||
}
|
||||
|
||||
private final class InternalGestureRecognizerDelegate: NSObject, UIGestureRecognizerDelegate {
|
||||
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
if otherGestureRecognizer is UIPanGestureRecognizer {
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
public final class TapLongTapOrDoubleTapGestureRecognizer: UIGestureRecognizer, UIGestureRecognizerDelegate {
|
||||
private let internalDelegate = InternalGestureRecognizerDelegate()
|
||||
|
||||
private var touchLocationAndTimestamp: (CGPoint, Double)?
|
||||
private var touchCount: Int = 0
|
||||
private var tapCount: Int = 0
|
||||
@ -96,14 +107,7 @@ public final class TapLongTapOrDoubleTapGestureRecognizer: UIGestureRecognizer,
|
||||
override public init(target: Any?, action: Selector?) {
|
||||
super.init(target: target, action: action)
|
||||
|
||||
self.delegate = self
|
||||
}
|
||||
|
||||
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
if otherGestureRecognizer is UIPanGestureRecognizer {
|
||||
return false
|
||||
}
|
||||
return false
|
||||
self.delegate = self.internalDelegate
|
||||
}
|
||||
|
||||
override public func reset() {
|
||||
|
@ -15,13 +15,28 @@ private func traceScrollView(view: UIView, point: CGPoint) -> UIScrollView? {
|
||||
return nil
|
||||
}
|
||||
|
||||
private final class InternalGestureRecognizerDelegate: NSObject, UIGestureRecognizerDelegate {
|
||||
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
if otherGestureRecognizer is UIPanGestureRecognizer {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
public class SwipeToDismissGestureRecognizer: UIGestureRecognizer, UIGestureRecognizerDelegate {
|
||||
private let internalDelegate = InternalGestureRecognizerDelegate()
|
||||
|
||||
private var beginPosition = CGPoint()
|
||||
|
||||
override public init(target: Any?, action: Selector?) {
|
||||
super.init(target: target, action: action)
|
||||
|
||||
self.delegate = self
|
||||
self.delegate = self.internalDelegate
|
||||
}
|
||||
|
||||
override public func reset() {
|
||||
@ -30,10 +45,6 @@ public class SwipeToDismissGestureRecognizer: UIGestureRecognizer, UIGestureReco
|
||||
self.state = .possible
|
||||
}
|
||||
|
||||
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
override public func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent) {
|
||||
super.touchesBegan(touches, with: event)
|
||||
|
||||
@ -101,11 +112,4 @@ public class SwipeToDismissGestureRecognizer: UIGestureRecognizer, UIGestureReco
|
||||
|
||||
self.state = .failed
|
||||
}
|
||||
|
||||
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
if otherGestureRecognizer is UIPanGestureRecognizer {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,33 @@ private func traceScrollViewUp(view: UIView) -> UIScrollView? {
|
||||
}
|
||||
}
|
||||
|
||||
private final class InternalGestureRecognizerDelegate: NSObject, UIGestureRecognizerDelegate {
|
||||
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
if let _ = otherGestureRecognizer.view as? PagerExpandableScrollView {
|
||||
return true
|
||||
}
|
||||
|
||||
if let _ = gestureRecognizer as? PagerPanGestureRecognizer {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
if let _ = otherGestureRecognizer.view as? PagerExpandableScrollView {
|
||||
return true
|
||||
}
|
||||
if otherGestureRecognizer is UIPanGestureRecognizer {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
private final class ExpansionPanRecognizer: UIGestureRecognizer, UIGestureRecognizerDelegate {
|
||||
private let internalDelegate = InternalGestureRecognizerDelegate()
|
||||
|
||||
enum LockDirection {
|
||||
case up
|
||||
case down
|
||||
@ -49,7 +75,7 @@ private final class ExpansionPanRecognizer: UIGestureRecognizer, UIGestureRecogn
|
||||
override public init(target: Any?, action: Selector?) {
|
||||
super.init(target: target, action: action)
|
||||
|
||||
self.delegate = self
|
||||
self.delegate = self.internalDelegate
|
||||
}
|
||||
|
||||
override public func reset() {
|
||||
@ -59,28 +85,6 @@ private final class ExpansionPanRecognizer: UIGestureRecognizer, UIGestureRecogn
|
||||
self.currentTranslation = CGPoint()
|
||||
}
|
||||
|
||||
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
if let _ = otherGestureRecognizer.view as? PagerExpandableScrollView {
|
||||
return true
|
||||
}
|
||||
|
||||
if let _ = gestureRecognizer as? PagerPanGestureRecognizer {
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
if let _ = otherGestureRecognizer.view as? PagerExpandableScrollView {
|
||||
return true
|
||||
}
|
||||
if otherGestureRecognizer is UIPanGestureRecognizer {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override public func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent) {
|
||||
super.touchesBegan(touches, with: event)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user