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

Unified Diff: ui/base/gestures/gesture_sequence.cc

Issue 11299276: Bound the maximum touchscreen fling velocity. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: ui/base/gestures/gesture_sequence.cc
diff --git a/ui/base/gestures/gesture_sequence.cc b/ui/base/gestures/gesture_sequence.cc
index 115229ab71a4c71069272d4239656878e0e836f1..235f4183e31b94314e9665b5a09eb0cfaea6b337 100644
--- a/ui/base/gestures/gesture_sequence.cc
+++ b/ui/base/gestures/gesture_sequence.cc
@@ -296,7 +296,13 @@ float CalibrateFlingVelocity(float velocity) {
nu += x * a;
x *= normalized_velocity;
}
- return nu * velocity;
+ fprintf(stderr, ">>> velo %f\n", nu * velocity);
+ fprintf(stderr, ">>> capped velo %f\n", std::max(nu * velocity,
+ GestureConfiguration::fling_velocity_cap()));
+ if (velocity < 0.f)
+ return std::max(nu * velocity, -GestureConfiguration::fling_velocity_cap());
+ else
+ return std::min(nu * velocity, GestureConfiguration::fling_velocity_cap());
}
} // namespace
« ui/base/gestures/gesture_configuration.cc ('K') | « ui/base/gestures/gesture_configuration.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698