From dc9ede68eb9a513886e42be0eb9b271401a3020c Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Sat, 7 Sep 2024 02:27:42 -0700 Subject: [PATCH] Debug gesture not recognizing --- YTLitePlus.xm | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/YTLitePlus.xm b/YTLitePlus.xm index 7e19727..1c0cf5c 100644 --- a/YTLitePlus.xm +++ b/YTLitePlus.xm @@ -910,6 +910,7 @@ BOOL isTabSelected = NO; // Handle gesture based on current gesture state if (panGestureRecognizer.state == UIGestureRecognizerStateBegan) { + NSLog(@"bhackel - Gesture began"); // Get the gesture's start position startLocation = [panGestureRecognizer locationInView:self.view]; CGFloat viewHeight = self.view.bounds.size.height; @@ -939,9 +940,11 @@ BOOL isTabSelected = NO; // Handle changed gesture state by activating the gesture once it has exited the deadzone, // and then adjusting the player based on the selected gesture mode if (panGestureRecognizer.state == UIGestureRecognizerStateChanged) { + NSLog(@"bhackel - Gesture changed"); // Determine if the gesture is predominantly horizontal CGPoint translation = [panGestureRecognizer translationInView:self.view]; if (!isValidHorizontalPan) { + NSLog(@"bhackel - Gesture not yet valid"); // Timeout // Check how much time has passed since the gesture started NSTimeInterval timeElapsed = [[NSDate date] timeIntervalSinceDate:gestureStartTime]; @@ -955,6 +958,7 @@ BOOL isTabSelected = NO; // Check if the touch has moved outside the deadzone CGFloat distanceFromStart = hypot(translation.x, translation.y); if (distanceFromStart < deadzoneRadius) { + NSLog(@"bhackel - Gesture within deadzone"); // If within the deadzone, don't activate the pan gesture return; } @@ -992,6 +996,7 @@ BOOL isTabSelected = NO; // Handle the gesture based on the identified section if (isValidHorizontalPan) { + NSLog(@"bhackel - Gesture valid"); // Adjust the X translation based on the value hit after exiting the deadzone adjustedTranslationX = translation.x - deadzoneStartingXTranslation; // Smooth the translation value @@ -1039,25 +1044,6 @@ BOOL isTabSelected = NO; // allow the pan gesture to be recognized simultaneously with other gestures %new - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { - if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]] && [otherGestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]]) { - // Do not allow this gesture to activate with the normal seek bar gesture - YTMainAppVideoPlayerOverlayViewController *mainVideoPlayerController = (YTMainAppVideoPlayerOverlayViewController *)self.childViewControllers.firstObject; - YTPlayerBarController *playerBarController = mainVideoPlayerController.playerBarController; - YTInlinePlayerBarContainerView *playerBar = playerBarController.playerBar; - if (otherGestureRecognizer == playerBar.scrubGestureRecognizer) { - return NO; - } - // Do not allow this gesture to activate with the fine scrubber gesture - YTFineScrubberFilmstripView *fineScrubberFilmstrip = playerBar.fineScrubberFilmstrip; - if (!fineScrubberFilmstrip) { - return YES; - } - YTFineScrubberFilmstripCollectionView *filmstripCollectionView = [fineScrubberFilmstrip valueForKey:@"_filmstripCollectionView"]; - if (filmstripCollectionView && otherGestureRecognizer == filmstripCollectionView.panGestureRecognizer) { - return NO; - } - - } return YES; } %end