Debug gesture not recognizing
This commit is contained in:
parent
0d3dfbe2c7
commit
dc9ede68eb
1 changed files with 5 additions and 19 deletions
|
|
@ -910,6 +910,7 @@ BOOL isTabSelected = NO;
|
||||||
|
|
||||||
// Handle gesture based on current gesture state
|
// Handle gesture based on current gesture state
|
||||||
if (panGestureRecognizer.state == UIGestureRecognizerStateBegan) {
|
if (panGestureRecognizer.state == UIGestureRecognizerStateBegan) {
|
||||||
|
NSLog(@"bhackel - Gesture began");
|
||||||
// Get the gesture's start position
|
// Get the gesture's start position
|
||||||
startLocation = [panGestureRecognizer locationInView:self.view];
|
startLocation = [panGestureRecognizer locationInView:self.view];
|
||||||
CGFloat viewHeight = self.view.bounds.size.height;
|
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,
|
// 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
|
// and then adjusting the player based on the selected gesture mode
|
||||||
if (panGestureRecognizer.state == UIGestureRecognizerStateChanged) {
|
if (panGestureRecognizer.state == UIGestureRecognizerStateChanged) {
|
||||||
|
NSLog(@"bhackel - Gesture changed");
|
||||||
// Determine if the gesture is predominantly horizontal
|
// Determine if the gesture is predominantly horizontal
|
||||||
CGPoint translation = [panGestureRecognizer translationInView:self.view];
|
CGPoint translation = [panGestureRecognizer translationInView:self.view];
|
||||||
if (!isValidHorizontalPan) {
|
if (!isValidHorizontalPan) {
|
||||||
|
NSLog(@"bhackel - Gesture not yet valid");
|
||||||
// Timeout
|
// Timeout
|
||||||
// Check how much time has passed since the gesture started
|
// Check how much time has passed since the gesture started
|
||||||
NSTimeInterval timeElapsed = [[NSDate date] timeIntervalSinceDate:gestureStartTime];
|
NSTimeInterval timeElapsed = [[NSDate date] timeIntervalSinceDate:gestureStartTime];
|
||||||
|
|
@ -955,6 +958,7 @@ BOOL isTabSelected = NO;
|
||||||
// Check if the touch has moved outside the deadzone
|
// Check if the touch has moved outside the deadzone
|
||||||
CGFloat distanceFromStart = hypot(translation.x, translation.y);
|
CGFloat distanceFromStart = hypot(translation.x, translation.y);
|
||||||
if (distanceFromStart < deadzoneRadius) {
|
if (distanceFromStart < deadzoneRadius) {
|
||||||
|
NSLog(@"bhackel - Gesture within deadzone");
|
||||||
// If within the deadzone, don't activate the pan gesture
|
// If within the deadzone, don't activate the pan gesture
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -992,6 +996,7 @@ BOOL isTabSelected = NO;
|
||||||
|
|
||||||
// Handle the gesture based on the identified section
|
// Handle the gesture based on the identified section
|
||||||
if (isValidHorizontalPan) {
|
if (isValidHorizontalPan) {
|
||||||
|
NSLog(@"bhackel - Gesture valid");
|
||||||
// Adjust the X translation based on the value hit after exiting the deadzone
|
// Adjust the X translation based on the value hit after exiting the deadzone
|
||||||
adjustedTranslationX = translation.x - deadzoneStartingXTranslation;
|
adjustedTranslationX = translation.x - deadzoneStartingXTranslation;
|
||||||
// Smooth the translation value
|
// Smooth the translation value
|
||||||
|
|
@ -1039,25 +1044,6 @@ BOOL isTabSelected = NO;
|
||||||
// allow the pan gesture to be recognized simultaneously with other gestures
|
// allow the pan gesture to be recognized simultaneously with other gestures
|
||||||
%new
|
%new
|
||||||
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
|
- (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;
|
return YES;
|
||||||
}
|
}
|
||||||
%end
|
%end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue