diff options
author | rjkroege@chromium.org <rjkroege@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-23 22:36:36 +0000 |
---|---|---|
committer | rjkroege@chromium.org <rjkroege@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-23 22:36:36 +0000 |
commit | 505dedbea66b502e6e84c67151468df535e031c6 (patch) | |
tree | ae0b86ed47a5285c91d53fb7b5029bad81af3b97 /ui | |
parent | ab7adf0b8c8bc31c7286c428c0001e6e41d81813 (diff) | |
download | chromium_src-505dedbea66b502e6e84c67151468df535e031c6.zip chromium_src-505dedbea66b502e6e84c67151468df535e031c6.tar.gz chromium_src-505dedbea66b502e6e84c67151468df535e031c6.tar.bz2 |
Make the fling acceleration constant adjustable from chrome://gesture
The GestureRecognizer applies an acceleration to touchscreen fling velocities
to make them align more nicely with the touchpad fling deacceleration curves.
Make this configurable from the interactive configurator.
BUG=141648
Review URL: https://chromiumcodereview.appspot.com/10861033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153097 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/aura/test/aura_test_base.cc | 2 | ||||
-rw-r--r-- | ui/base/gestures/gesture_configuration.cc | 4 | ||||
-rw-r--r-- | ui/base/gestures/gesture_configuration.h | 7 | ||||
-rw-r--r-- | ui/base/gestures/gesture_sequence.cc | 3 |
4 files changed, 15 insertions, 1 deletions
diff --git a/ui/aura/test/aura_test_base.cc b/ui/aura/test/aura_test_base.cc index e9609ee..5dbb9fc 100644 --- a/ui/aura/test/aura_test_base.cc +++ b/ui/aura/test/aura_test_base.cc @@ -44,6 +44,8 @@ void AuraTestBase::SetUp() { ui::GestureConfiguration::set_rail_break_proportion(15); ui::GestureConfiguration::set_rail_start_proportion(2); ui::GestureConfiguration::set_default_radius(0); + ui::GestureConfiguration::set_touchscreen_fling_acceleration_adjustment( + 1.f / 900.f); helper_.reset(new AuraTestHelper(&message_loop_)); helper_->SetUp(); } diff --git a/ui/base/gestures/gesture_configuration.cc b/ui/base/gestures/gesture_configuration.cc index 5ba5f34..a53685e 100644 --- a/ui/base/gestures/gesture_configuration.cc +++ b/ui/base/gestures/gesture_configuration.cc @@ -36,4 +36,8 @@ int GestureConfiguration::points_buffered_for_velocity_ = 3; double GestureConfiguration::rail_break_proportion_ = 15; double GestureConfiguration::rail_start_proportion_ = 2; +// The additional acceleration to apply to touchscreen flings. +double GestureConfiguration::touchscreen_fling_acceleration_adjustment_ + = 1.f / 900.f; + } // namespace ui diff --git a/ui/base/gestures/gesture_configuration.h b/ui/base/gestures/gesture_configuration.h index 1b0caa4..7deac42 100644 --- a/ui/base/gestures/gesture_configuration.h +++ b/ui/base/gestures/gesture_configuration.h @@ -133,6 +133,12 @@ class UI_EXPORT GestureConfiguration { static void set_rail_start_proportion(double val) { rail_start_proportion_ = val; } + static double touchscreen_fling_acceleration_adjustment() { + return touchscreen_fling_acceleration_adjustment_; + } + static void set_touchscreen_fling_acceleration_adjustment(double val) { + touchscreen_fling_acceleration_adjustment_ = val; + } private: // These are listed in alphabetical order ignoring underscores, to @@ -169,6 +175,7 @@ class UI_EXPORT GestureConfiguration { static int points_buffered_for_velocity_; static double rail_break_proportion_; static double rail_start_proportion_; + static double touchscreen_fling_acceleration_adjustment_; DISALLOW_COPY_AND_ASSIGN(GestureConfiguration); }; diff --git a/ui/base/gestures/gesture_sequence.cc b/ui/base/gestures/gesture_sequence.cc index 5039bc4..7760a0d 100644 --- a/ui/base/gestures/gesture_sequence.cc +++ b/ui/base/gestures/gesture_sequence.cc @@ -278,7 +278,8 @@ float CalibrateFlingVelocity(float velocity) { // touchpad scroll-events. This curve needs to be adjusted to work correctly // with both touchpad and touchscreen. Until then, scale quadratically. // http://crbug.com/120154 - const float velocity_scaling = 1.f / 900.f; + const float velocity_scaling = + GestureConfiguration::touchscreen_fling_acceleration_adjustment(); return velocity_scaling * velocity * fabsf(velocity); } |