OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_DETECTOR_H_ | 5 #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_DETECTOR_H_ |
6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_DETECTOR_H_ | 6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_DETECTOR_H_ |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ui/events/gesture_detection/gesture_detection_export.h" | 10 #include "ui/events/gesture_detection/gesture_detection_export.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 // Whether |OnTwoFingerTap| should be called for two finger tap | 62 // Whether |OnTwoFingerTap| should be called for two finger tap |
63 // gestures. Defaults to false. | 63 // gestures. Defaults to false. |
64 bool two_finger_tap_enabled; | 64 bool two_finger_tap_enabled; |
65 | 65 |
66 // Maximum distance between pointers for a two finger tap. | 66 // Maximum distance between pointers for a two finger tap. |
67 float two_finger_tap_max_separation; | 67 float two_finger_tap_max_separation; |
68 | 68 |
69 // Maximum time the second pointer can be active for a two finger tap. | 69 // Maximum time the second pointer can be active for a two finger tap. |
70 base::TimeDelta two_finger_tap_timeout; | 70 base::TimeDelta two_finger_tap_timeout; |
71 | 71 |
72 // Single tap count repetition length. Defaults to 1 (no repetition count). | |
73 // Note that when double-tap detection is enabled, the single tap repeat | |
74 // count will always be 1. | |
75 int single_tap_repeat_length; | |
76 | |
72 VelocityTracker::Strategy velocity_tracker_strategy; | 77 VelocityTracker::Strategy velocity_tracker_strategy; |
73 }; | 78 }; |
74 | 79 |
75 GestureDetector(const Config& config, | 80 GestureDetector(const Config& config, |
76 GestureListener* listener, | 81 GestureListener* listener, |
77 DoubleTapListener* optional_double_tap_listener); | 82 DoubleTapListener* optional_double_tap_listener); |
78 ~GestureDetector(); | 83 ~GestureDetector(); |
79 | 84 |
80 bool OnTouchEvent(const MotionEvent& ev); | 85 bool OnTouchEvent(const MotionEvent& ev); |
81 | 86 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 bool two_finger_tap_allowed_for_gesture_; | 132 bool two_finger_tap_allowed_for_gesture_; |
128 | 133 |
129 scoped_ptr<MotionEvent> current_down_event_; | 134 scoped_ptr<MotionEvent> current_down_event_; |
130 scoped_ptr<MotionEvent> previous_up_event_; | 135 scoped_ptr<MotionEvent> previous_up_event_; |
131 scoped_ptr<MotionEvent> secondary_pointer_down_event_; | 136 scoped_ptr<MotionEvent> secondary_pointer_down_event_; |
132 | 137 |
133 // True when the user is still touching for the second tap (down, move, and | 138 // True when the user is still touching for the second tap (down, move, and |
134 // up events). Can only be true if there is a double tap listener attached. | 139 // up events). Can only be true if there is a double tap listener attached. |
135 bool is_double_tapping_; | 140 bool is_double_tapping_; |
136 | 141 |
142 int single_tap_count_; | |
tdresser
2015/09/23 14:10:46
The semantics of this variable feel a bit confusin
jdduke (slow)
2015/09/23 19:56:04
Yeah, though I think we'll need an auxiliary varia
tdresser
2015/09/24 12:05:00
Thanks - I find this easier to follow.
| |
143 int single_tap_repeat_length_; | |
144 | |
137 float last_focus_x_; | 145 float last_focus_x_; |
138 float last_focus_y_; | 146 float last_focus_y_; |
139 float down_focus_x_; | 147 float down_focus_x_; |
140 float down_focus_y_; | 148 float down_focus_y_; |
141 | 149 |
142 bool longpress_enabled_; | 150 bool longpress_enabled_; |
143 bool showpress_enabled_; | 151 bool showpress_enabled_; |
144 bool swipe_enabled_; | 152 bool swipe_enabled_; |
145 bool two_finger_tap_enabled_; | 153 bool two_finger_tap_enabled_; |
146 | 154 |
147 // Determines speed during touch scrolling. | 155 // Determines speed during touch scrolling. |
148 VelocityTrackerState velocity_tracker_; | 156 VelocityTrackerState velocity_tracker_; |
149 | 157 |
150 DISALLOW_COPY_AND_ASSIGN(GestureDetector); | 158 DISALLOW_COPY_AND_ASSIGN(GestureDetector); |
151 }; | 159 }; |
152 | 160 |
153 } // namespace ui | 161 } // namespace ui |
154 | 162 |
155 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_DETECTOR_H_ | 163 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_DETECTOR_H_ |
OLD | NEW |