summaryrefslogtreecommitdiffstats
path: root/ui/aura/gestures/gesture_point.h
diff options
context:
space:
mode:
authortdresser@chromium.org <tdresser@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-07 22:07:08 +0000
committertdresser@chromium.org <tdresser@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-07 22:07:08 +0000
commitaa4fb9e4f144c2c17b34fb8b1fed3ebd66e797d8 (patch)
treef97e3dd4afcb8263ca54cc690d9f4886f9f72143 /ui/aura/gestures/gesture_point.h
parent658acfba7817de677611a6add3b38fb81ac0a029 (diff)
downloadchromium_src-aa4fb9e4f144c2c17b34fb8b1fed3ebd66e797d8.zip
chromium_src-aa4fb9e4f144c2c17b34fb8b1fed3ebd66e797d8.tar.gz
chromium_src-aa4fb9e4f144c2c17b34fb8b1fed3ebd66e797d8.tar.bz2
Event smoothing in CrOS gesture recognizer.
Each GesturePoint owns a VelocityCalculator, which maintains a history of touch positions and times, and gives the GesturePoint its velocity. An ordinary least squares regression is used to calculate the velocities. BUG=110229 TEST=aura_unittests Review URL: http://codereview.chromium.org/9310031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120835 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura/gestures/gesture_point.h')
-rw-r--r--ui/aura/gestures/gesture_point.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/ui/aura/gestures/gesture_point.h b/ui/aura/gestures/gesture_point.h
index f39d252..ff715ea 100644
--- a/ui/aura/gestures/gesture_point.h
+++ b/ui/aura/gestures/gesture_point.h
@@ -7,6 +7,7 @@
#pragma once
#include "base/basictypes.h"
+#include "ui/aura/gestures/velocity_calculator.h"
#include "ui/gfx/point.h"
namespace aura {
@@ -44,7 +45,7 @@ class GesturePoint {
bool IsInClickWindow(const TouchEvent& event) const;
bool IsInDoubleClickWindow(const TouchEvent& event) const;
bool IsInScrollWindow(const TouchEvent& event) const;
- bool IsInFlickWindow(const TouchEvent& event) const;
+ bool IsInFlickWindow(const TouchEvent& event);
bool DidScroll(const TouchEvent& event) const;
const gfx::Point& first_touch_position() const {
@@ -62,8 +63,8 @@ class GesturePoint {
return last_touch_position_.y() - first_touch_position_.y();
}
- float x_velocity() const { return x_velocity_; }
- float y_velocity() const { return y_velocity_; }
+ float XVelocity() { return velocity_calculator_.XVelocity(); }
+ float YVelocity() { return velocity_calculator_.YVelocity(); }
private:
// Various statistical functions to manipulate gestures.
@@ -71,7 +72,7 @@ class GesturePoint {
bool IsInSecondClickTimeWindow() const;
bool IsInsideManhattanSquare(const TouchEvent& event) const;
bool IsSecondClickInsideManhattanSquare(const TouchEvent& event) const;
- bool IsOverMinFlickSpeed() const;
+ bool IsOverMinFlickSpeed();
gfx::Point first_touch_position_;
double first_touch_time_;
@@ -81,8 +82,7 @@ class GesturePoint {
double last_tap_time_;
gfx::Point last_tap_position_;
- float x_velocity_;
- float y_velocity_;
+ VelocityCalculator velocity_calculator_;
DISALLOW_COPY_AND_ASSIGN(GesturePoint);
};