From 30ccc8017f25668538b801ab7f6a031ffdd6d9c6 Mon Sep 17 00:00:00 2001 From: Isaac <> Date: Wed, 9 Jul 2025 18:37:10 +0400 Subject: [PATCH] Adjust transition gesture --- ...teractiveTransitionGestureRecognizer.swift | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/submodules/Display/Source/InteractiveTransitionGestureRecognizer.swift b/submodules/Display/Source/InteractiveTransitionGestureRecognizer.swift index 56120b515e..3ee59f2b5c 100644 --- a/submodules/Display/Source/InteractiveTransitionGestureRecognizer.swift +++ b/submodules/Display/Source/InteractiveTransitionGestureRecognizer.swift @@ -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 + } } } }