Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ui / events / gestures / fling_curve.h
blob583e172c999bb8e6660181058463fcbc4c00c490
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_EVENTS_GESTURES_FLING_CURVE_H_
6 #define UI_EVENTS_GESTURES_FLING_CURVE_H_
8 #include "base/time/time.h"
9 #include "ui/events/events_base_export.h"
10 #include "ui/gfx/geometry/point_f.h"
11 #include "ui/gfx/geometry/vector2d_f.h"
13 namespace ui {
15 // FlingCurve can be used to scroll a UI element suitable for touch screen-based
16 // flings.
17 class EVENTS_BASE_EXPORT FlingCurve {
18 public:
19 FlingCurve(const gfx::Vector2dF& velocity, base::TimeTicks start_timestamp);
20 ~FlingCurve();
22 gfx::Vector2dF GetScrollAmountAtTime(base::TimeTicks current_timestamp);
23 base::TimeTicks start_timestamp() const { return start_timestamp_; }
25 private:
26 const float curve_duration_;
27 const base::TimeTicks start_timestamp_;
29 gfx::Vector2dF displacement_ratio_;
30 gfx::Vector2dF cumulative_scroll_;
31 base::TimeTicks last_timestamp_;
32 float time_offset_;
33 float position_offset_;
35 DISALLOW_COPY_AND_ASSIGN(FlingCurve);
38 } // namespace ui
40 #endif // UI_EVENTS_GESTURES_FLING_CURVE_H_