| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 #include "ui/events/gestures/gesture_configuration.h" | 5 #include "ui/events/gestures/gesture_configuration.h" |
| 6 | 6 |
| 7 namespace ui { | 7 namespace ui { |
| 8 | 8 |
| 9 int GestureConfiguration::default_radius_ = 25; | 9 int GestureConfiguration::default_radius_ = 25; |
| 10 int GestureConfiguration::fling_max_cancel_to_down_time_in_ms_ = 400; | 10 int GestureConfiguration::fling_max_cancel_to_down_time_in_ms_ = 400; |
| 11 int GestureConfiguration::fling_max_tap_gap_time_in_ms_ = 200; | 11 int GestureConfiguration::fling_max_tap_gap_time_in_ms_ = 200; |
| 12 float GestureConfiguration::fling_velocity_cap_ = 17000.0f; | 12 float GestureConfiguration::fling_velocity_cap_ = 17000.0f; |
| 13 int GestureConfiguration::tab_scrub_activation_delay_in_ms_ = 200; | 13 int GestureConfiguration::tab_scrub_activation_delay_in_ms_ = 200; |
| 14 double GestureConfiguration::long_press_time_in_seconds_ = 1.0; | 14 double GestureConfiguration::long_press_time_in_seconds_ = 1.0; |
| 15 double GestureConfiguration::semi_long_press_time_in_seconds_ = 0.4; | 15 double GestureConfiguration::semi_long_press_time_in_seconds_ = 0.4; |
| 16 double GestureConfiguration::max_distance_for_two_finger_tap_in_pixels_ = 300; | 16 double GestureConfiguration::max_distance_for_two_finger_tap_in_pixels_ = 300; |
| 17 int GestureConfiguration::max_radius_ = 100; | |
| 18 double GestureConfiguration::max_seconds_between_double_click_ = 0.7; | 17 double GestureConfiguration::max_seconds_between_double_click_ = 0.7; |
| 19 double | 18 double |
| 20 GestureConfiguration::max_separation_for_gesture_touches_in_pixels_ = 150; | 19 GestureConfiguration::max_separation_for_gesture_touches_in_pixels_ = 150; |
| 21 float GestureConfiguration::max_swipe_deviation_angle_ = 20; | 20 float GestureConfiguration::max_swipe_deviation_angle_ = 20; |
| 22 double | 21 double |
| 23 GestureConfiguration::max_touch_down_duration_in_seconds_for_click_ = 0.8; | 22 GestureConfiguration::max_touch_down_duration_in_seconds_for_click_ = 0.8; |
| 24 double GestureConfiguration::max_touch_move_in_pixels_for_click_ = 15; | 23 double GestureConfiguration::max_touch_move_in_pixels_for_click_ = 15; |
| 25 double GestureConfiguration::max_distance_between_taps_for_double_tap_ = 20; | 24 double GestureConfiguration::max_distance_between_taps_for_double_tap_ = 20; |
| 26 double GestureConfiguration::min_distance_for_pinch_scroll_in_pixels_ = 20; | 25 double GestureConfiguration::min_distance_for_pinch_scroll_in_pixels_ = 20; |
| 27 double GestureConfiguration::min_flick_speed_squared_ = 550.f * 550.f; | |
| 28 double GestureConfiguration::min_pinch_update_distance_in_pixels_ = 5; | 26 double GestureConfiguration::min_pinch_update_distance_in_pixels_ = 5; |
| 29 double GestureConfiguration::min_rail_break_velocity_ = 200; | |
| 30 double GestureConfiguration::min_scroll_delta_squared_ = 4 * 4; | |
| 31 float GestureConfiguration::min_scroll_velocity_ = 30.0f; | 27 float GestureConfiguration::min_scroll_velocity_ = 30.0f; |
| 32 double GestureConfiguration::min_swipe_speed_ = 20; | 28 double GestureConfiguration::min_swipe_speed_ = 20; |
| 33 double GestureConfiguration::scroll_prediction_seconds_ = 0.03; | |
| 34 double | |
| 35 GestureConfiguration::min_touch_down_duration_in_seconds_for_click_ = 0.01; | |
| 36 | 29 |
| 37 // If this is too small, we currently can get single finger pinch zoom. See | 30 // If this is too small, we currently can get single finger pinch zoom. See |
| 38 // crbug.com/357237 for details. | 31 // crbug.com/357237 for details. |
| 39 int GestureConfiguration::min_scaling_span_in_pixels_ = 125; | 32 int GestureConfiguration::min_scaling_span_in_pixels_ = 125; |
| 40 | |
| 41 // The number of points used in the linear regression which determines | |
| 42 // touch velocity. Velocity is reported for 2 or more touch move events. | |
| 43 int GestureConfiguration::points_buffered_for_velocity_ = 8; | |
| 44 double GestureConfiguration::rail_break_proportion_ = 15; | |
| 45 double GestureConfiguration::rail_start_proportion_ = 2; | |
| 46 int GestureConfiguration::show_press_delay_in_ms_ = 150; | 33 int GestureConfiguration::show_press_delay_in_ms_ = 150; |
| 47 | 34 |
| 48 // TODO(jdduke): Disable and remove entirely when issues with intermittent | 35 // TODO(jdduke): Disable and remove entirely when issues with intermittent |
| 49 // scroll end detection on the Pixel are resolved, crbug.com/353702. | 36 // scroll end detection on the Pixel are resolved, crbug.com/353702. |
| 50 #if defined(OS_CHROMEOS) | 37 #if defined(OS_CHROMEOS) |
| 51 int GestureConfiguration::scroll_debounce_interval_in_ms_ = 30; | 38 int GestureConfiguration::scroll_debounce_interval_in_ms_ = 30; |
| 52 #else | 39 #else |
| 53 int GestureConfiguration::scroll_debounce_interval_in_ms_ = 0; | 40 int GestureConfiguration::scroll_debounce_interval_in_ms_ = 0; |
| 54 #endif | 41 #endif |
| 55 | 42 |
| 56 // Coefficients for a function that computes fling acceleration. | 43 // Coefficients for a function that computes fling acceleration. |
| 57 // These are empirically determined defaults. Do not adjust without | 44 // These are empirically determined defaults. Do not adjust without |
| 58 // additional empirical validation. | 45 // additional empirical validation. |
| 59 float GestureConfiguration::fling_acceleration_curve_coefficients_[ | 46 float GestureConfiguration::fling_acceleration_curve_coefficients_[ |
| 60 NumAccelParams] = { | 47 NumAccelParams] = { |
| 61 0.0166667f, | 48 0.0166667f, |
| 62 -0.0238095f, | 49 -0.0238095f, |
| 63 0.0452381f, | 50 0.0452381f, |
| 64 0.8f | 51 0.8f |
| 65 }; | 52 }; |
| 66 | 53 |
| 67 } // namespace ui | 54 } // namespace ui |
| OLD | NEW |