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

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

Issue 1778063002: Eliminate pinch drift by removing touch radius from span calculation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Shrink minimum scale span. Created 4 years, 9 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_CONFIGURATION_H_ 5 #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_CONFIGURATION_H_
6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_CONFIGURATION_H_ 6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_CONFIGURATION_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "ui/events/gesture_detection/gesture_detection_export.h" 9 #include "ui/events/gesture_detection/gesture_detection_export.h"
10 #include "ui/events/gesture_detection/velocity_tracker.h" 10 #include "ui/events/gesture_detection/velocity_tracker.h"
11 11
12 namespace ui { 12 namespace ui {
13 13
14 class GESTURE_DETECTION_EXPORT GestureConfiguration { 14 class GESTURE_DETECTION_EXPORT GestureConfiguration {
15 public: 15 public:
16 // Sets the shared instance. This does not take ownership of |config|. 16 // Sets the shared instance. This does not take ownership of |config|.
17 static void SetInstance(GestureConfiguration* config); 17 static void SetInstance(GestureConfiguration* config);
18 // Returns the singleton GestureConfiguration. 18 // Returns the singleton GestureConfiguration.
19 static GestureConfiguration* GetInstance(); 19 static GestureConfiguration* GetInstance();
20 20
21 // Ordered alphabetically ignoring underscores. 21 // Ordered alphabetically ignoring underscores.
22 float default_radius() const { return default_radius_; } 22 float default_radius() const { return default_radius_; }
23 void set_default_radius(float radius) { 23 void set_default_radius(float radius) {
24 default_radius_ = radius; 24 default_radius_ = radius;
25 min_scaling_touch_major_ = default_radius_ * 2;
26 min_gesture_bounds_length_ = default_radius_; 25 min_gesture_bounds_length_ = default_radius_;
27 } 26 }
28 bool double_tap_enabled() const { return double_tap_enabled_; } 27 bool double_tap_enabled() const { return double_tap_enabled_; }
29 void set_double_tap_enabled(bool enabled) { double_tap_enabled_ = enabled; } 28 void set_double_tap_enabled(bool enabled) { double_tap_enabled_ = enabled; }
30 int double_tap_timeout_in_ms() const { return double_tap_timeout_in_ms_; } 29 int double_tap_timeout_in_ms() const { return double_tap_timeout_in_ms_; }
31 bool fling_touchpad_tap_suppression_enabled() const { 30 bool fling_touchpad_tap_suppression_enabled() const {
32 return fling_touchpad_tap_suppression_enabled_; 31 return fling_touchpad_tap_suppression_enabled_;
33 } 32 }
34 void set_fling_touchpad_tap_suppression_enabled(bool enabled) { 33 void set_fling_touchpad_tap_suppression_enabled(bool enabled) {
35 fling_touchpad_tap_suppression_enabled_ = enabled; 34 fling_touchpad_tap_suppression_enabled_ = enabled;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 132 }
134 void set_min_pinch_update_span_delta(float val) { 133 void set_min_pinch_update_span_delta(float val) {
135 min_pinch_update_span_delta_ = val; 134 min_pinch_update_span_delta_ = val;
136 } 135 }
137 float min_scaling_span_in_pixels() const { 136 float min_scaling_span_in_pixels() const {
138 return min_scaling_span_in_pixels_; 137 return min_scaling_span_in_pixels_;
139 } 138 }
140 void set_min_scaling_span_in_pixels(float val) { 139 void set_min_scaling_span_in_pixels(float val) {
141 min_scaling_span_in_pixels_ = val; 140 min_scaling_span_in_pixels_ = val;
142 } 141 }
143 float min_scaling_touch_major() const { return min_scaling_touch_major_; }
144 float min_swipe_velocity() const { return min_swipe_velocity_; } 142 float min_swipe_velocity() const { return min_swipe_velocity_; }
145 void set_min_swipe_velocity(float val) { min_swipe_velocity_ = val; } 143 void set_min_swipe_velocity(float val) { min_swipe_velocity_ = val; }
146 int scroll_debounce_interval_in_ms() const { 144 int scroll_debounce_interval_in_ms() const {
147 return scroll_debounce_interval_in_ms_; 145 return scroll_debounce_interval_in_ms_;
148 } 146 }
149 int set_scroll_debounce_interval_in_ms(int val) { 147 int set_scroll_debounce_interval_in_ms(int val) {
150 return scroll_debounce_interval_in_ms_ = val; 148 return scroll_debounce_interval_in_ms_ = val;
151 } 149 }
152 int semi_long_press_time_in_ms() const { 150 int semi_long_press_time_in_ms() const {
153 return semi_long_press_time_in_ms_; 151 return semi_long_press_time_in_ms_;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 184
187 // The below configuration parameters are dependent on other parameters, 185 // The below configuration parameters are dependent on other parameters,
188 // whose setter functions will setup these values as well, so we will not 186 // whose setter functions will setup these values as well, so we will not
189 // provide public setter functions for them. 187 // provide public setter functions for them.
190 void set_double_tap_timeout_in_ms(int val) { 188 void set_double_tap_timeout_in_ms(int val) {
191 double_tap_timeout_in_ms_ = val; 189 double_tap_timeout_in_ms_ = val;
192 } 190 }
193 void set_min_gesture_bounds_length(float val) { 191 void set_min_gesture_bounds_length(float val) {
194 min_gesture_bounds_length_ = val; 192 min_gesture_bounds_length_ = val;
195 } 193 }
196 void set_min_scaling_touch_major(float val) {
197 min_scaling_touch_major_ = val;
198 }
199 void set_span_slop(float val) { span_slop_ = val; } 194 void set_span_slop(float val) { span_slop_ = val; }
200 195
201 private: 196 private:
202 // Returns the platform specific instance. This is invoked if a specific 197 // Returns the platform specific instance. This is invoked if a specific
203 // instance has not been set. 198 // instance has not been set.
204 static GestureConfiguration* GetPlatformSpecificInstance(); 199 static GestureConfiguration* GetPlatformSpecificInstance();
205 200
206 // These are listed in alphabetical order ignoring underscores. 201 // These are listed in alphabetical order ignoring underscores.
207 // NOTE: Adding new configuration parameters requires initializing 202 // NOTE: Adding new configuration parameters requires initializing
208 // corresponding entries in aura_test_base.cc's SetUp(). 203 // corresponding entries in aura_test_base.cc's SetUp().
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 float max_swipe_deviation_angle_; 241 float max_swipe_deviation_angle_;
247 int max_time_between_double_click_in_ms_; 242 int max_time_between_double_click_in_ms_;
248 int max_touch_down_duration_for_click_in_ms_; 243 int max_touch_down_duration_for_click_in_ms_;
249 float max_touch_move_in_pixels_for_click_; 244 float max_touch_move_in_pixels_for_click_;
250 float min_distance_for_pinch_scroll_in_pixels_; 245 float min_distance_for_pinch_scroll_in_pixels_;
251 float min_fling_velocity_; 246 float min_fling_velocity_;
252 float min_gesture_bounds_length_; 247 float min_gesture_bounds_length_;
253 // Only used with --compensate-for-unstable-pinch-zoom. 248 // Only used with --compensate-for-unstable-pinch-zoom.
254 float min_pinch_update_span_delta_; 249 float min_pinch_update_span_delta_;
255 float min_scaling_span_in_pixels_; 250 float min_scaling_span_in_pixels_;
256 float min_scaling_touch_major_;
257 float min_swipe_velocity_; 251 float min_swipe_velocity_;
258 int scroll_debounce_interval_in_ms_; 252 int scroll_debounce_interval_in_ms_;
259 int semi_long_press_time_in_ms_; 253 int semi_long_press_time_in_ms_;
260 int show_press_delay_in_ms_; 254 int show_press_delay_in_ms_;
261 float span_slop_; 255 float span_slop_;
262 bool swipe_enabled_; 256 bool swipe_enabled_;
263 257
264 // TODO(davemoore): Move into chrome/browser/ui. 258 // TODO(davemoore): Move into chrome/browser/ui.
265 int tab_scrub_activation_delay_in_ms_; 259 int tab_scrub_activation_delay_in_ms_;
266 bool two_finger_tap_enabled_; 260 bool two_finger_tap_enabled_;
267 VelocityTracker::Strategy velocity_tracker_strategy_; 261 VelocityTracker::Strategy velocity_tracker_strategy_;
268 262
269 DISALLOW_COPY_AND_ASSIGN(GestureConfiguration); 263 DISALLOW_COPY_AND_ASSIGN(GestureConfiguration);
270 }; 264 };
271 265
272 } // namespace ui 266 } // namespace ui
273 267
274 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_CONFIGURATION_H_ 268 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_CONFIGURATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698