OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 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_config_helper.h" | |
6 | |
7 #include "ui/events/gesture_configuration.h" | |
8 #include "ui/gfx/screen.h" | |
9 | |
10 namespace ui { | |
11 namespace { | |
12 | |
13 GestureDetector::Config DefaultGestureDetectorConfig() { | |
14 GestureDetector::Config config; | |
15 | |
16 config.longpress_timeout = | |
17 base::TimeDelta::FromSecondsF( | |
18 GestureConfiguration::long_press_time_in_seconds()); | |
tdresser
2014/02/19 17:44:12
Could be wrapped onto two lines, as could a few ot
| |
19 config.tap_timeout = ; | |
tdresser
2014/02/19 17:44:12
That is a scary ;.
jdduke (slow)
2014/02/19 18:51:58
Haha, yeah, you'll notice I never bothered compili
| |
20 base::TimeDelta::FromMilliseconds( | |
21 GestureConfiguration::show_press_delay_in_ms()); | |
22 config.double_tap_timeout = ; | |
tdresser
2014/02/19 17:44:12
;
jdduke (slow)
2014/02/19 18:51:58
Done.
| |
23 base::TimeDelta::FromSecondsF( | |
24 GestureConfiguration::semi_long_press_time_in_seconds()); | |
25 config.scaled_touch_slop = | |
26 GestureConfiguration::max_touch_move_in_pixels_for_click(); | |
27 config.scaled_double_tap_slop = | |
28 GestureConfiguration::max_distance_between_taps_for_double_tap(); | |
29 config.scaled_minimum_fling_velocity = | |
30 GestureConfiguration::min_scroll_velocity(); | |
31 config.scaled_maximum_fling_velocity = | |
32 GestureConfiguration::fling_velocity_cap(); | |
33 | |
34 return config; | |
35 } | |
36 | |
37 ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig() { | |
38 ScaleGestureDetector::Config config; | |
39 | |
40 config.gesture_detector_config = GetGestureDetectorConfig(); | |
41 config.quick_scale_enabled = false; | |
42 config.min_scaling_touch_major = GestureConfiguration::default_radius() / 2; | |
43 config.min_scaling_span = | |
44 GestureConfiguration::min_distance_for_pinch_scroll_in_pixels() | |
45 | |
46 return config; | |
47 } | |
48 | |
49 SnapScrollController::Config DefaultSnapScrollControllerConfig() { | |
50 SnapScrollController::Config config; | |
51 | |
52 const gfx::Display& display = | |
53 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | |
54 | |
55 config.screen_width_pixels = display.GetSizeInPixel().width(); | |
56 config.screen_height_pixels = display.GetSizeInPixel().height(); | |
57 config.device_scale_factor = display.device_scale_factor(); | |
58 | |
59 return config; | |
60 } | |
61 | |
62 GestureHandler::Config DefaultGestureHandlerConfig() { | |
63 GestureHandler::Config config; | |
64 config.gesture_detector_config = DefaultGestureDetectorConfig(); | |
65 config.scale_gesture_detector_config = DefaultScaleGestureDetectorConfig(); | |
66 config.snap_scroll_controller_config = DefaultSnapScrollControllerConfig(); | |
67 return config; | |
68 } | |
69 | |
70 } // namespace ui | |
71 | |
72 #endif // UI_EVENTS_GESTURE_DETECTION__H_ | |
OLD | NEW |