OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/events/gesture_detection/gesture_configuration.h" |
| 6 |
| 7 namespace ui { |
| 8 |
| 9 GestureConfiguration::GestureConfiguration() |
| 10 : default_radius_(25), |
| 11 max_distance_for_two_finger_tap_in_pixels_(300), |
| 12 fling_max_cancel_to_down_time_in_ms_(400), |
| 13 fling_max_tap_gap_time_in_ms_(200), |
| 14 long_press_time_in_ms_(1000), |
| 15 semi_long_press_time_in_ms_(400), |
| 16 max_time_between_double_click_in_ms_(700), |
| 17 max_separation_for_gesture_touches_in_pixels_(150), |
| 18 max_swipe_deviation_angle_(20), |
| 19 max_touch_down_duration_for_click_in_ms_(800), |
| 20 max_touch_move_in_pixels_for_click_(15), |
| 21 max_distance_between_taps_for_double_tap_(20), |
| 22 min_distance_for_pinch_scroll_in_pixels_(20), |
| 23 min_pinch_update_distance_in_pixels_(5), |
| 24 min_scroll_velocity_(30.0f), |
| 25 min_swipe_speed_(20), |
| 26 |
| 27 // If this is too small, we currently can get single finger pinch zoom. |
| 28 // See |
| 29 // crbug.com/357237 for details. |
| 30 min_scaling_span_in_pixels_(125), |
| 31 show_press_delay_in_ms_(150), |
| 32 fling_velocity_cap_(17000.0f), |
| 33 tab_scrub_activation_delay_in_ms_(200) { |
| 34 // TODO(jdduke): Disable and remove entirely when issues with intermittent |
| 35 // scroll end detection on the Pixel are resolved, crbug.com/353702. |
| 36 #if defined(OS_CHROMEOS) |
| 37 scroll_debounce_interval_in_ms_ = 30; |
| 38 #else |
| 39 scroll_debounce_interval_in_ms_ = 0; |
| 40 #endif |
| 41 } |
| 42 |
| 43 GestureConfiguration::~GestureConfiguration() { |
| 44 } |
| 45 |
| 46 GestureDetector::Config GestureConfiguration::DefaultGestureDetectorConfig() { |
| 47 GestureDetector::Config config; |
| 48 config.longpress_timeout = |
| 49 base::TimeDelta::FromMilliseconds(long_press_time_in_ms()); |
| 50 config.showpress_timeout = |
| 51 base::TimeDelta::FromMilliseconds(show_press_delay_in_ms()); |
| 52 config.double_tap_timeout = |
| 53 base::TimeDelta::FromMilliseconds(semi_long_press_time_in_ms()); |
| 54 config.touch_slop = max_touch_move_in_pixels_for_click(); |
| 55 config.double_tap_slop = max_distance_between_taps_for_double_tap(); |
| 56 config.minimum_fling_velocity = min_scroll_velocity(); |
| 57 config.maximum_fling_velocity = fling_velocity_cap(); |
| 58 |
| 59 return config; |
| 60 } |
| 61 |
| 62 ScaleGestureDetector::Config |
| 63 GestureConfiguration::DefaultScaleGestureDetectorConfig() { |
| 64 ScaleGestureDetector::Config config; |
| 65 config.span_slop = span_slop(); |
| 66 config.min_scaling_touch_major = min_scaling_touch_major(); |
| 67 config.min_scaling_span = min_scaling_span_in_pixels(); |
| 68 config.min_pinch_update_span_delta = min_pinch_update_span_delta(); |
| 69 return config; |
| 70 } |
| 71 |
| 72 } // namespace ui |
OLD | NEW |