mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Adjust transition gesture
This commit is contained in:
parent
8d2b9255a6
commit
30ccc8017f
@ -143,7 +143,15 @@ public class InteractiveTransitionGestureRecognizer: UIPanGestureRecognizer {
|
||||
|
||||
if self.currentAllowedDirections.contains(.down) {
|
||||
if !self.validatedGesture {
|
||||
if absTranslationX > 2.0 && absTranslationX > absTranslationY * 2.0 {
|
||||
let totalMovement = sqrt(absTranslationX * absTranslationX + absTranslationY * absTranslationY)
|
||||
if totalMovement > 10.0 {
|
||||
// Force dominant direction after 10pt movement
|
||||
if absTranslationY >= absTranslationX {
|
||||
self.validatedGesture = true
|
||||
} else {
|
||||
self.state = .failed
|
||||
}
|
||||
} else if absTranslationX > 2.0 && absTranslationX > absTranslationY * 2.0 {
|
||||
self.state = .failed
|
||||
} else if absTranslationY > 2.0 && absTranslationX * 2.0 < absTranslationY {
|
||||
self.validatedGesture = true
|
||||
@ -176,11 +184,22 @@ public class InteractiveTransitionGestureRecognizer: UIPanGestureRecognizer {
|
||||
self.state = .failed
|
||||
} else if !self.currentAllowedDirections.contains(.rightCenter) && translation.x > 0.0 {
|
||||
self.state = .failed
|
||||
} else if absTranslationY > 2.0 && absTranslationY > absTranslationX * 2.0 {
|
||||
self.state = .failed
|
||||
} else if absTranslationX > 2.0 && absTranslationY * 2.0 < absTranslationX {
|
||||
self.validatedGesture = true
|
||||
fireBegan = true
|
||||
} else {
|
||||
let totalMovement = sqrt(absTranslationX * absTranslationX + absTranslationY * absTranslationY)
|
||||
if totalMovement > 10.0 {
|
||||
// Force dominant direction after 10pt movement
|
||||
if absTranslationX >= absTranslationY {
|
||||
self.validatedGesture = true
|
||||
fireBegan = true
|
||||
} else {
|
||||
self.state = .failed
|
||||
}
|
||||
} else if absTranslationY > 2.0 && absTranslationY > absTranslationX * 2.0 {
|
||||
self.state = .failed
|
||||
} else if absTranslationX > 2.0 && absTranslationY * 2.0 < absTranslationX {
|
||||
self.validatedGesture = true
|
||||
fireBegan = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user