Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Side by Side Diff: ui/events/gesture_detection/gesture_config_helper_aura.cc

Issue 278073004: Revert of Unified Gesture Recognizer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/events/events.gyp ('k') | ui/events/gesture_detection/motion_event.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // MSVC++ requires this to be set before any other includes to get M_PI.
6 #define _USE_MATH_DEFINES
7
8 #include "ui/events/gesture_detection/gesture_config_helper.h" 5 #include "ui/events/gesture_detection/gesture_config_helper.h"
9 6
10 #include <cmath>
11
12 #include "ui/events/gestures/gesture_configuration.h" 7 #include "ui/events/gestures/gesture_configuration.h"
13 #include "ui/gfx/screen.h" 8 #include "ui/gfx/screen.h"
14 9
15 namespace ui { 10 namespace ui {
16 namespace { 11 namespace {
17 12
18 GestureDetector::Config DefaultGestureDetectorConfig() { 13 GestureDetector::Config DefaultGestureDetectorConfig() {
19 GestureDetector::Config config; 14 GestureDetector::Config config;
20 15
21 config.longpress_timeout = base::TimeDelta::FromMilliseconds( 16 config.longpress_timeout = base::TimeDelta::FromMilliseconds(
22 GestureConfiguration::long_press_time_in_seconds() * 1000.); 17 GestureConfiguration::long_press_time_in_seconds() * 1000.);
23 config.showpress_timeout = base::TimeDelta::FromMilliseconds( 18 config.showpress_timeout = base::TimeDelta::FromMilliseconds(
24 GestureConfiguration::show_press_delay_in_ms()); 19 GestureConfiguration::show_press_delay_in_ms());
25 config.double_tap_timeout = base::TimeDelta::FromMilliseconds( 20 config.double_tap_timeout = base::TimeDelta::FromMilliseconds(
26 GestureConfiguration::semi_long_press_time_in_seconds() * 1000.); 21 GestureConfiguration::semi_long_press_time_in_seconds() * 1000.);
27 config.touch_slop = 22 config.touch_slop =
28 GestureConfiguration::max_touch_move_in_pixels_for_click(); 23 GestureConfiguration::max_touch_move_in_pixels_for_click();
29 config.double_tap_slop = 24 config.double_tap_slop =
30 GestureConfiguration::max_distance_between_taps_for_double_tap(); 25 GestureConfiguration::max_distance_between_taps_for_double_tap();
31 config.minimum_fling_velocity = 26 config.minimum_fling_velocity =
32 GestureConfiguration::min_scroll_velocity(); 27 GestureConfiguration::min_scroll_velocity();
33 config.maximum_fling_velocity = 28 config.maximum_fling_velocity =
34 GestureConfiguration::fling_velocity_cap(); 29 GestureConfiguration::fling_velocity_cap();
35 config.swipe_enabled = true; 30 config.swipe_enabled = true;
36 config.minimum_swipe_velocity = GestureConfiguration::min_swipe_speed(); 31 config.minimum_swipe_velocity = GestureConfiguration::min_swipe_speed();
37 config.maximum_swipe_deviation_angle = 32 config.maximum_swipe_deviation_angle =
38 atan2(1.f, GestureConfiguration::max_swipe_deviation_ratio()) * 180.0f / 33 atan2(1.f, GestureConfiguration::max_swipe_deviation_ratio());
39 static_cast<float>(M_PI);
40 34
41 return config; 35 return config;
42 } 36 }
43 37
44 ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig() { 38 ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig() {
45 ScaleGestureDetector::Config config; 39 ScaleGestureDetector::Config config;
46 40
47 config.gesture_detector_config = DefaultGestureDetectorConfig(); 41 config.gesture_detector_config = DefaultGestureDetectorConfig();
48 config.min_scaling_touch_major = GestureConfiguration::default_radius() * 2; 42 config.min_scaling_touch_major = GestureConfiguration::default_radius() * 2;
49 config.min_scaling_span = GestureConfiguration::min_scaling_span_in_pixels(); 43 config.min_scaling_span =
44 GestureConfiguration::min_distance_for_pinch_scroll_in_pixels();
50 return config; 45 return config;
51 } 46 }
52 47
53 } // namespace 48 } // namespace
54 49
55 GestureProvider::Config DefaultGestureProviderConfig() { 50 GestureProvider::Config DefaultGestureProviderConfig() {
56 GestureProvider::Config config; 51 GestureProvider::Config config;
57 config.display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); 52 config.display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
58 config.gesture_detector_config = DefaultGestureDetectorConfig(); 53 config.gesture_detector_config = DefaultGestureDetectorConfig();
59 config.scale_gesture_detector_config = DefaultScaleGestureDetectorConfig(); 54 config.scale_gesture_detector_config = DefaultScaleGestureDetectorConfig();
60 config.gesture_begin_end_types_enabled = true; 55 config.gesture_begin_end_types_enabled = true;
61 return config; 56 return config;
62 } 57 }
63 58
64 } // namespace ui 59 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/events.gyp ('k') | ui/events/gesture_detection/motion_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698