Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Unified Diff: ios/chrome/browser/ui/side_swipe_gesture_recognizer.mm

Issue 2281303002: Work around PanGestureRecognizer iOS10 issue. (Closed)
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/side_swipe_gesture_recognizer.mm
diff --git a/ios/chrome/browser/ui/side_swipe_gesture_recognizer.mm b/ios/chrome/browser/ui/side_swipe_gesture_recognizer.mm
index 72f608c76ab89627b019f2e872de700a1cd1958f..b4a463a9db0983458cd7896a51bb9c76617e3f58 100644
--- a/ios/chrome/browser/ui/side_swipe_gesture_recognizer.mm
+++ b/ios/chrome/browser/ui/side_swipe_gesture_recognizer.mm
@@ -47,6 +47,7 @@ const CGFloat kDefaultMinSwipeXThreshold = 4;
UITouch* touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:self.view];
+ _startPoint = CGPointZero;
if (_swipeEdge > 0) {
if (location.x > _swipeEdge &&
location.x < CGRectGetMaxX([self.view bounds]) - _swipeEdge) {
@@ -78,6 +79,16 @@ const CGFloat kDefaultMinSwipeXThreshold = 4;
return;
}
+ // In iOS10, sometimes a PanGestureRecognizer will fire a touchesMoved even
+ // after touchesBegan sets its state to |UIGestureRecognizerStateFailed|.
+ // Somehow the state is re-set to UIGestureRecognizerStatePossible, and ends
+ // up in moved. Checking if |_startPoint| has been set is a secondary way to
+ // catch for failed gestures.
+ if (CGPointEqualToPoint(_startPoint, CGPointZero)) {
+ self.state = UIGestureRecognizerStateFailed;
+ return;
+ }
+
// Don't swipe at an angle greater than |kMaxSwipeYAngle|.
UITouch* touch = [[event allTouches] anyObject];
CGPoint currentPoint = [touch locationInView:self.view];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698