OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/chrome/browser/ui/side_swipe_gesture_recognizer.h" | 5 #import "ios/chrome/browser/ui/side_swipe_gesture_recognizer.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 // The absolute maximum swipe angle from |x = y| for a swipe to begin. | 13 // The absolute maximum swipe angle from |x = y| for a swipe to begin. |
14 CGFloat kMaxSwipeYAngle = 65; | 14 const CGFloat kMaxSwipeYAngle = 65; |
15 // The distance between touches for a swipe to begin. | 15 // The distance between touches for a swipe to begin. |
16 CGFloat kMinSwipeXThreshold = 4; | 16 const CGFloat kMinSwipeXThreshold = 4; |
17 | 17 |
18 } // namespace | 18 } // namespace |
19 | 19 |
20 @implementation SideSwipeGestureRecognizer { | 20 @implementation SideSwipeGestureRecognizer { |
21 // Starting point of swipe. | 21 // Starting point of swipe. |
22 CGPoint _startPoint; | 22 CGPoint _startPoint; |
23 // Expected direction of the swipe, based on starting point. | 23 // Expected direction of the swipe, based on starting point. |
24 UISwipeGestureRecognizerDirection _direction; | 24 UISwipeGestureRecognizerDirection _direction; |
25 } | 25 } |
26 | 26 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 _startPoint = CGPointZero; | 97 _startPoint = CGPointZero; |
98 [super touchesEnded:touches withEvent:event]; | 98 [super touchesEnded:touches withEvent:event]; |
99 } | 99 } |
100 | 100 |
101 - (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event { | 101 - (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event { |
102 _startPoint = CGPointZero; | 102 _startPoint = CGPointZero; |
103 [super touchesCancelled:touches withEvent:event]; | 103 [super touchesCancelled:touches withEvent:event]; |
104 } | 104 } |
105 | 105 |
106 @end | 106 @end |
OLD | NEW |