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

Side by Side Diff: ui/events/gesture_detection/gesture_detector.h

Issue 2058723003: Slop region check for multi-finger scroll (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
OLDNEW
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 <memory> 8 #include <memory>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 void Init(const Config& config); 103 void Init(const Config& config);
104 void OnShowPressTimeout(); 104 void OnShowPressTimeout();
105 void OnLongPressTimeout(); 105 void OnLongPressTimeout();
106 void OnTapTimeout(); 106 void OnTapTimeout();
107 void Cancel(); 107 void Cancel();
108 void CancelTaps(); 108 void CancelTaps();
109 bool IsRepeatedTap(const MotionEvent& first_down, 109 bool IsRepeatedTap(const MotionEvent& first_down,
110 const MotionEvent& first_up, 110 const MotionEvent& first_up,
111 const MotionEvent& second_down) const; 111 const MotionEvent& second_down) const;
112 bool HandleSwipeIfNeeded(const MotionEvent& up, float vx, float vy); 112 bool HandleSwipeIfNeeded(const MotionEvent& up, float vx, float vy);
113 bool IsWithinTouchSlop(const MotionEvent& ev);
113 114
114 class TimeoutGestureHandler; 115 class TimeoutGestureHandler;
115 std::unique_ptr<TimeoutGestureHandler> timeout_handler_; 116 std::unique_ptr<TimeoutGestureHandler> timeout_handler_;
116 GestureListener* const listener_; 117 GestureListener* const listener_;
117 DoubleTapListener* double_tap_listener_; 118 DoubleTapListener* double_tap_listener_;
118 119
119 float touch_slop_square_; 120 float touch_slop_square_;
120 float double_tap_touch_slop_square_; 121 float double_tap_touch_slop_square_;
121 float double_tap_slop_square_; 122 float double_tap_slop_square_;
122 float two_finger_tap_distance_square_; 123 float two_finger_tap_distance_square_;
123 float min_fling_velocity_; 124 float min_fling_velocity_;
124 float max_fling_velocity_; 125 float max_fling_velocity_;
125 float min_swipe_velocity_; 126 float min_swipe_velocity_;
126 float min_swipe_direction_component_ratio_; 127 float min_swipe_direction_component_ratio_;
127 base::TimeDelta double_tap_timeout_; 128 base::TimeDelta double_tap_timeout_;
128 base::TimeDelta two_finger_tap_timeout_; 129 base::TimeDelta two_finger_tap_timeout_;
129 base::TimeDelta double_tap_min_time_; 130 base::TimeDelta double_tap_min_time_;
130 131
131 bool still_down_; 132 bool still_down_;
132 bool defer_confirm_single_tap_; 133 bool defer_confirm_single_tap_;
133 bool always_in_tap_region_; 134 bool all_pointers_within_slop_regions_;
134 bool always_in_bigger_tap_region_; 135 bool always_in_bigger_tap_region_;
135 bool two_finger_tap_allowed_for_gesture_; 136 bool two_finger_tap_allowed_for_gesture_;
136 137
137 std::unique_ptr<MotionEvent> current_down_event_; 138 std::unique_ptr<MotionEvent> current_down_event_;
138 std::unique_ptr<MotionEvent> previous_up_event_; 139 std::unique_ptr<MotionEvent> previous_up_event_;
139 std::unique_ptr<MotionEvent> secondary_pointer_down_event_; 140 std::unique_ptr<MotionEvent> secondary_pointer_down_event_;
140 141
141 // True when the user is still touching for the second tap (down, move, and 142 // True when the user is still touching for the second tap (down, move, and
142 // up events). Can only be true if there is a double tap listener attached. 143 // up events). Can only be true if there is a double tap listener attached.
143 bool is_double_tapping_; 144 bool is_double_tapping_;
144 145
145 // Whether the current ACTION_DOWN event meets the criteria for being a 146 // Whether the current ACTION_DOWN event meets the criteria for being a
146 // repeated tap. Note that it will be considered a repeated tap only if the 147 // repeated tap. Note that it will be considered a repeated tap only if the
147 // corresponding ACTION_UP yields a valid tap and double-tap detection is 148 // corresponding ACTION_UP yields a valid tap and double-tap detection is
148 // disabled. 149 // disabled.
149 bool is_down_candidate_for_repeated_single_tap_; 150 bool is_down_candidate_for_repeated_single_tap_;
150 151
152 // Stores the maximum number of pointers that have been down simultaneously
153 // during the current touch sequenece.
tdresser 2016/07/01 14:29:15 sequence
sahel 2016/07/05 20:36:35 Done.
154 int maximum_pointer_count_;
155
151 // The number of repeated taps in the current sequence, i.e., for the initial 156 // The number of repeated taps in the current sequence, i.e., for the initial
152 // tap this is 0, for the first *repeated* tap 1, etc... 157 // tap this is 0, for the first *repeated* tap 1, etc...
153 int current_single_tap_repeat_count_; 158 int current_single_tap_repeat_count_;
154 int single_tap_repeat_interval_; 159 int single_tap_repeat_interval_;
155 160
156 float last_focus_x_; 161 float last_focus_x_;
157 float last_focus_y_; 162 float last_focus_y_;
158 float down_focus_x_; 163 float down_focus_x_;
159 float down_focus_y_; 164 float down_focus_y_;
160 165
161 bool longpress_enabled_; 166 bool longpress_enabled_;
162 bool showpress_enabled_; 167 bool showpress_enabled_;
163 bool swipe_enabled_; 168 bool swipe_enabled_;
164 bool two_finger_tap_enabled_; 169 bool two_finger_tap_enabled_;
165 170
166 // Determines speed during touch scrolling. 171 // Determines speed during touch scrolling.
167 VelocityTrackerState velocity_tracker_; 172 VelocityTrackerState velocity_tracker_;
168 173
169 DISALLOW_COPY_AND_ASSIGN(GestureDetector); 174 DISALLOW_COPY_AND_ASSIGN(GestureDetector);
170 }; 175 };
171 176
172 } // namespace ui 177 } // namespace ui
173 178
174 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_DETECTOR_H_ 179 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_DETECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698