gesture_configuration.cc 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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
  3. // found in the LICENSE file.
  4. #include "build/build_config.h"
  5. #include "ui/events/gesture_detection/gesture_configuration.h"
  6. #include "build/chromeos_buildflags.h"
  7. namespace ui {
  8. namespace {
  9. GestureConfiguration* instance = nullptr;
  10. } // namespace
  11. // static
  12. GestureConfiguration* GestureConfiguration::GetInstance() {
  13. if (instance)
  14. return instance;
  15. return GestureConfiguration::GetPlatformSpecificInstance();
  16. }
  17. GestureConfiguration::GestureConfiguration()
  18. : default_radius_(25),
  19. double_tap_enabled_(false),
  20. double_tap_timeout_in_ms_(400),
  21. fling_touchpad_tap_suppression_enabled_(false),
  22. fling_touchscreen_tap_suppression_enabled_(false),
  23. fling_max_cancel_to_down_time_in_ms_(400),
  24. fling_max_tap_gap_time_in_ms_(200),
  25. stylus_scale_enabled_(false),
  26. gesture_begin_end_types_enabled_(false),
  27. long_press_time_in_ms_(500),
  28. max_distance_between_taps_for_double_tap_(20),
  29. max_tap_count_(3),
  30. max_distance_for_two_finger_tap_in_pixels_(300),
  31. max_fling_velocity_(17000.0f),
  32. max_gesture_bounds_length_(0),
  33. max_separation_for_gesture_touches_in_pixels_(150),
  34. max_swipe_deviation_angle_(20),
  35. max_time_between_double_click_in_ms_(700),
  36. max_touch_down_duration_for_click_in_ms_(800),
  37. max_touch_move_in_pixels_for_click_(15),
  38. min_distance_for_pinch_scroll_in_pixels_(20),
  39. min_fling_velocity_(30.0f),
  40. min_gesture_bounds_length_(0),
  41. min_pinch_update_span_delta_(0),
  42. // If this is too small, we currently can get single finger pinch zoom.
  43. // See crbug.com/357237 for details.
  44. min_scaling_span_in_pixels_(125),
  45. min_swipe_velocity_(20),
  46. // TODO(jdduke): Disable and remove entirely when issues with intermittent
  47. // scroll end detection on the Pixel are resolved, crbug.com/353702.
  48. #if BUILDFLAG(IS_CHROMEOS_ASH)
  49. scroll_debounce_interval_in_ms_(30),
  50. #else
  51. scroll_debounce_interval_in_ms_(0),
  52. #endif
  53. show_press_delay_in_ms_(150),
  54. #if BUILDFLAG(IS_CHROMEOS_ASH)
  55. single_pointer_cancel_enabled_(true),
  56. #else
  57. single_pointer_cancel_enabled_(false),
  58. #endif
  59. // The default value of span_slop_ is
  60. // 2 * max_touch_move_in_pixels_for_click_.
  61. span_slop_(30),
  62. swipe_enabled_(false),
  63. two_finger_tap_enabled_(false),
  64. velocity_tracker_strategy_(VelocityTracker::Strategy::STRATEGY_DEFAULT) {
  65. }
  66. GestureConfiguration::~GestureConfiguration() {
  67. }
  68. } // namespace ui