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

Unified Diff: ui/aura/gestures/gesture_point.cc

Issue 9751011: Gesture recognition constants should all be stored in the GestureConfiguration object. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Protect unit tests from changes in GestureConfiguration. Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: ui/aura/gestures/gesture_point.cc
diff --git a/ui/aura/gestures/gesture_point.cc b/ui/aura/gestures/gesture_point.cc
index a531f706e458d9eb7c9b86bbb2137b53c55f58f2..978b2d48aaea2da08e0f10599f41387a33e731cc 100644
--- a/ui/aura/gestures/gesture_point.cc
+++ b/ui/aura/gestures/gesture_point.cc
@@ -11,23 +11,14 @@
#include "ui/aura/gestures/gesture_configuration.h"
#include "ui/base/events.h"
-namespace {
-
-const int kMinRailBreakVelocity = 200;
-const int kMinScrollDeltaSquared = 5 * 5;
-const int kRailBreakProportion = 15;
-const int kRailStartProportion = 2;
-const int kBufferedPoints = 10;
-
-} // namespace
-
namespace aura {
GesturePoint::GesturePoint()
: first_touch_time_(0.0),
last_touch_time_(0.0),
last_tap_time_(0.0),
- velocity_calculator_(kBufferedPoints),
+ velocity_calculator_(
+ GestureConfiguration::points_buffered_for_velocity()),
girard 2012/03/20 18:30:59 As per my other comment. This should not be confi
point_id_(-1) {
}
@@ -110,31 +101,33 @@ bool GesturePoint::HasEnoughDataToEstablishRail() const {
int dy = y_delta();
int delta_squared = dx * dx + dy * dy;
- return delta_squared > kMinScrollDeltaSquared;
+ return delta_squared > GestureConfiguration::min_scroll_delta_squared();
}
bool GesturePoint::IsInHorizontalRailWindow() const {
int dx = x_delta();
int dy = y_delta();
- return abs(dx) > kRailStartProportion * abs(dy);
+ return abs(dx) > GestureConfiguration::rail_start_proportion() * abs(dy);
}
bool GesturePoint::IsInVerticalRailWindow() const {
int dx = x_delta();
int dy = y_delta();
- return abs(dy) > kRailStartProportion * abs(dx);
+ return abs(dy) > GestureConfiguration::rail_start_proportion() * abs(dx);
}
bool GesturePoint::BreaksHorizontalRail() {
float vx = XVelocity();
float vy = YVelocity();
- return fabs(vy) > kRailBreakProportion * fabs(vx) + kMinRailBreakVelocity;
+ return fabs(vy) > GestureConfiguration::rail_break_proportion() * fabs(vx) +
+ GestureConfiguration::min_rail_break_velocity();
}
bool GesturePoint::BreaksVerticalRail() {
float vx = XVelocity();
float vy = YVelocity();
- return fabs(vx) > kRailBreakProportion * fabs(vy) + kMinRailBreakVelocity;
+ return fabs(vx) > GestureConfiguration::rail_break_proportion() * fabs(vy) +
+ GestureConfiguration::min_rail_break_velocity();
}
bool GesturePoint::IsInClickTimeWindow() const {

Powered by Google App Engine
This is Rietveld 408576698