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"
15 // FlingCurve can be used to scroll a UI element suitable for touch screen-based
17 class EVENTS_BASE_EXPORT FlingCurve {
19 FlingCurve(const gfx::Vector2dF& velocity, base::TimeTicks start_timestamp);
22 gfx::Vector2dF GetScrollAmountAtTime(base::TimeTicks current_timestamp);
23 base::TimeTicks start_timestamp() const { return start_timestamp_; }
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_;
33 float position_offset_;
35 DISALLOW_COPY_AND_ASSIGN(FlingCurve);
40 #endif // UI_EVENTS_GESTURES_FLING_CURVE_H_