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

Unified Diff: ui/events/gestures/fling_curve.h

Issue 436213002: athena: Add support for fling-scroll in overview mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test Created 6 years, 4 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
« no previous file with comments | « ui/events/events.gyp ('k') | ui/events/gestures/fling_curve.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/gestures/fling_curve.h
diff --git a/ui/events/gestures/fling_curve.h b/ui/events/gestures/fling_curve.h
new file mode 100644
index 0000000000000000000000000000000000000000..583e172c999bb8e6660181058463fcbc4c00c490
--- /dev/null
+++ b/ui/events/gestures/fling_curve.h
@@ -0,0 +1,40 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_EVENTS_GESTURES_FLING_CURVE_H_
+#define UI_EVENTS_GESTURES_FLING_CURVE_H_
+
+#include "base/time/time.h"
+#include "ui/events/events_base_export.h"
+#include "ui/gfx/geometry/point_f.h"
+#include "ui/gfx/geometry/vector2d_f.h"
+
+namespace ui {
+
+// FlingCurve can be used to scroll a UI element suitable for touch screen-based
+// flings.
+class EVENTS_BASE_EXPORT FlingCurve {
+ public:
+ FlingCurve(const gfx::Vector2dF& velocity, base::TimeTicks start_timestamp);
+ ~FlingCurve();
+
+ gfx::Vector2dF GetScrollAmountAtTime(base::TimeTicks current_timestamp);
+ base::TimeTicks start_timestamp() const { return start_timestamp_; }
+
+ private:
+ const float curve_duration_;
+ const base::TimeTicks start_timestamp_;
+
+ gfx::Vector2dF displacement_ratio_;
+ gfx::Vector2dF cumulative_scroll_;
+ base::TimeTicks last_timestamp_;
+ float time_offset_;
+ float position_offset_;
+
+ DISALLOW_COPY_AND_ASSIGN(FlingCurve);
+};
+
+} // namespace ui
+
+#endif // UI_EVENTS_GESTURES_FLING_CURVE_H_
« no previous file with comments | « ui/events/events.gyp ('k') | ui/events/gestures/fling_curve.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698