diff options
author | rjkroege@chromium.org <rjkroege@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-03 18:14:57 +0000 |
---|---|---|
committer | rjkroege@chromium.org <rjkroege@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-03 18:14:57 +0000 |
commit | 6a660e670543db8232ea24a17dd6a7720f756cf3 (patch) | |
tree | f674b574f587ddb3f9f5ae5d5e8d5af5abac3a85 /ui/base/gestures/gesture_sequence.cc | |
parent | d33f8bb636e4e878cb34bda3846b304f5ce5cb05 (diff) | |
download | chromium_src-6a660e670543db8232ea24a17dd6a7720f756cf3.zip chromium_src-6a660e670543db8232ea24a17dd6a7720f756cf3.tar.gz chromium_src-6a660e670543db8232ea24a17dd6a7720f756cf3.tar.bz2 |
Bound the maximum touchscreen fling velocity.
Set a configurable cap on the maximum touchscreen fling velocity.
BUG=141653
Review URL: https://chromiumcodereview.appspot.com/11299276
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170761 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/gestures/gesture_sequence.cc')
-rw-r--r-- | ui/base/gestures/gesture_sequence.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ui/base/gestures/gesture_sequence.cc b/ui/base/gestures/gesture_sequence.cc index 115229a..07d42ed 100644 --- a/ui/base/gestures/gesture_sequence.cc +++ b/ui/base/gestures/gesture_sequence.cc @@ -296,7 +296,10 @@ float CalibrateFlingVelocity(float velocity) { nu += x * a; x *= normalized_velocity; } - return nu * velocity; + if (velocity < 0.f) + return std::max(nu * velocity, -GestureConfiguration::fling_velocity_cap()); + else + return std::min(nu * velocity, GestureConfiguration::fling_velocity_cap()); } } // namespace |