Chromium Code Reviews| Index: ui/events/gesture_detection/gesture_detector.h |
| diff --git a/ui/events/gesture_detection/gesture_detector.h b/ui/events/gesture_detection/gesture_detector.h |
| index 5fe6a27c82e4a75f1c0f811752df0be1d9d096ba..f44b21577e2293504240c9af007553a692fa2a7c 100644 |
| --- a/ui/events/gesture_detection/gesture_detector.h |
| +++ b/ui/events/gesture_detection/gesture_detector.h |
| @@ -40,6 +40,18 @@ class GestureDetector { |
| // Maximum velocity of an initiated fling (in dips/second). |
| float maximum_fling_velocity; |
| + |
| + // Whether |OnSwipe| should be called after a secondary touch is released |
| + // while a logical swipe gesture is active. Defaults to false. |
| + bool swipe_enabled; |
| + |
| + // Minimum velocity to initiate a swipe (in dips/second). |
| + float minimum_swipe_velocity; |
| + |
| + // Maximum angle of the swipe from it's dominant component axis, between |
|
tdresser
2014/04/24 12:42:40
Extremely nitful nit.
it's -> its
jdduke (slow)
2014/04/24 15:13:55
Done.
|
| + // (0, 45] degrees. The closer this is to 0, the closer the dominant |
| + // direction of the swipe must be to up, down left or right. |
| + float maximum_swipe_deviation_angle; |
| }; |
| class GestureListener { |
| @@ -49,10 +61,19 @@ class GestureDetector { |
| virtual void OnShowPress(const MotionEvent& e) = 0; |
| virtual bool OnSingleTapUp(const MotionEvent& e) = 0; |
| virtual bool OnLongPress(const MotionEvent& e) = 0; |
| - virtual bool OnScroll(const MotionEvent& e1, const MotionEvent& e2, |
| - float distance_x, float distance_y) = 0; |
| - virtual bool OnFling(const MotionEvent& e1, const MotionEvent& e2, |
| - float velocity_x, float velocity_y) = 0; |
| + virtual bool OnScroll(const MotionEvent& e1, |
| + const MotionEvent& e2, |
| + float distance_x, |
| + float distance_y) = 0; |
| + virtual bool OnFling(const MotionEvent& e1, |
| + const MotionEvent& e2, |
| + float velocity_x, |
| + float velocity_y) = 0; |
| + // Added for Chromium (Aura). |
| + virtual bool OnSwipe(const MotionEvent& e1, |
| + const MotionEvent& e2, |
| + float velocity_x, |
| + float velocity_y) = 0; |
| }; |
| class DoubleTapListener { |
| @@ -75,10 +96,18 @@ class GestureDetector { |
| virtual void OnShowPress(const MotionEvent& e) OVERRIDE; |
| virtual bool OnSingleTapUp(const MotionEvent& e) OVERRIDE; |
| virtual bool OnLongPress(const MotionEvent& e) OVERRIDE; |
| - virtual bool OnScroll(const MotionEvent& e1, const MotionEvent& e2, |
| - float distance_x, float distance_y) OVERRIDE; |
| - virtual bool OnFling(const MotionEvent& e1, const MotionEvent& e2, |
| - float velocity_x, float velocity_y) OVERRIDE; |
| + virtual bool OnScroll(const MotionEvent& e1, |
| + const MotionEvent& e2, |
| + float distance_x, |
| + float distance_y) OVERRIDE; |
| + virtual bool OnFling(const MotionEvent& e1, |
| + const MotionEvent& e2, |
| + float velocity_x, |
| + float velocity_y) OVERRIDE; |
| + virtual bool OnSwipe(const MotionEvent& e1, |
| + const MotionEvent& e2, |
| + float velocity_x, |
| + float velocity_y) OVERRIDE; |
| // DoubleTapListener implementation. |
| virtual bool OnSingleTapConfirmed(const MotionEvent& e) OVERRIDE; |
| @@ -102,11 +131,7 @@ class GestureDetector { |
| bool is_double_tapping() const { return is_double_tapping_; } |
| - void set_is_longpress_enabled(bool is_longpress_enabled) { |
| - is_longpress_enabled_ = is_longpress_enabled; |
| - } |
| - |
| - bool is_longpress_enabled() const { return is_longpress_enabled_; } |
| + void set_longpress_enabled(bool enabled) { longpress_enabled_ = enabled; } |
| private: |
| void Init(const Config& config); |
| @@ -129,6 +154,8 @@ class GestureDetector { |
| float double_tap_slop_square_; |
| float min_fling_velocity_; |
| float max_fling_velocity_; |
| + float min_swipe_velocity_; |
| + float min_swipe_direction_component_ratio_; |
| base::TimeDelta double_tap_timeout_; |
| bool still_down_; |
| @@ -149,7 +176,8 @@ class GestureDetector { |
| float down_focus_x_; |
| float down_focus_y_; |
| - bool is_longpress_enabled_; |
| + bool longpress_enabled_; |
| + bool swipe_enabled_; |
| // Determines speed during touch scrolling. |
| VelocityTrackerState velocity_tracker_; |