OLD | NEW |
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 #include "ui/events/gesture_detection/gesture_config_helper.h" | 5 #include "ui/events/gesture_detection/gesture_config_helper.h" |
6 | 6 |
7 #include "ui/gfx/android/view_configuration.h" | 7 #include "ui/gfx/android/view_configuration.h" |
8 #include "ui/gfx/screen.h" | 8 #include "ui/gfx/screen.h" |
9 | 9 |
10 using gfx::ViewConfiguration; | 10 using gfx::ViewConfiguration; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 config.maximum_fling_velocity = | 42 config.maximum_fling_velocity = |
43 ViewConfiguration::GetMaximumFlingVelocityInPixelsPerSecond() * px_to_dp; | 43 ViewConfiguration::GetMaximumFlingVelocityInPixelsPerSecond() * px_to_dp; |
44 | 44 |
45 return config; | 45 return config; |
46 } | 46 } |
47 | 47 |
48 ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig( | 48 ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig( |
49 const gfx::Display& display) { | 49 const gfx::Display& display) { |
50 ScaleGestureDetector::Config config; | 50 ScaleGestureDetector::Config config; |
51 | 51 |
52 config.gesture_detector_config = DefaultGestureDetectorConfig(display); | |
53 config.quick_scale_enabled = true; | |
54 | |
55 const float px_to_dp = 1.f / display.device_scale_factor(); | 52 const float px_to_dp = 1.f / display.device_scale_factor(); |
| 53 config.span_slop = ViewConfiguration::GetTouchSlopInPixels() * 2.f * px_to_dp; |
56 config.min_scaling_touch_major = | 54 config.min_scaling_touch_major = |
57 ViewConfiguration::GetMinScalingTouchMajorInPixels() * px_to_dp; | 55 ViewConfiguration::GetMinScalingTouchMajorInPixels() * px_to_dp; |
58 config.min_scaling_span = | 56 config.min_scaling_span = |
59 ViewConfiguration::GetMinScalingSpanInPixels() * px_to_dp; | 57 ViewConfiguration::GetMinScalingSpanInPixels() * px_to_dp; |
| 58 config.min_pinch_update_span_delta = 0.f; |
60 | 59 |
61 return config; | 60 return config; |
62 } | 61 } |
63 | 62 |
64 } // namespace | 63 } // namespace |
65 | 64 |
66 GestureProvider::Config DefaultGestureProviderConfig() { | 65 GestureProvider::Config DefaultGestureProviderConfig() { |
67 GestureProvider::Config config; | 66 GestureProvider::Config config; |
68 config.display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | 67 config.display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); |
69 config.gesture_detector_config = DefaultGestureDetectorConfig(config.display); | 68 config.gesture_detector_config = DefaultGestureDetectorConfig(config.display); |
70 config.scale_gesture_detector_config = | 69 config.scale_gesture_detector_config = |
71 DefaultScaleGestureDetectorConfig(config.display); | 70 DefaultScaleGestureDetectorConfig(config.display); |
72 config.gesture_begin_end_types_enabled = false; | 71 config.gesture_begin_end_types_enabled = false; |
73 config.min_gesture_bounds_length = kMinGestureBoundsLengthDips; | 72 config.min_gesture_bounds_length = kMinGestureBoundsLengthDips; |
74 config.max_gesture_bounds_length = kMaxGestureBoundsLengthDips; | 73 config.max_gesture_bounds_length = kMaxGestureBoundsLengthDips; |
75 return config; | 74 return config; |
76 } | 75 } |
77 | 76 |
78 } // namespace ui | 77 } // namespace ui |
OLD | NEW |