| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_EVENTS_GESTURES_FLING_CURVE_H_ | 5 #ifndef UI_EVENTS_GESTURES_FLING_CURVE_H_ |
| 6 #define UI_EVENTS_GESTURES_FLING_CURVE_H_ | 6 #define UI_EVENTS_GESTURES_FLING_CURVE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "ui/events/events_base_export.h" | 10 #include "ui/events/events_base_export.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 bool ComputeScrollOffset(base::TimeTicks time, | 25 bool ComputeScrollOffset(base::TimeTicks time, |
| 26 gfx::Vector2dF* offset, | 26 gfx::Vector2dF* offset, |
| 27 gfx::Vector2dF* velocity) override; | 27 gfx::Vector2dF* velocity) override; |
| 28 | 28 |
| 29 // In contrast to |ComputeScrollOffset()|, this method is stateful and | 29 // In contrast to |ComputeScrollOffset()|, this method is stateful and |
| 30 // returns the *change* in scroll offset between successive calls. | 30 // returns the *change* in scroll offset between successive calls. |
| 31 // Returns true as long as the curve is still active and requires additional | 31 // Returns true as long as the curve is still active and requires additional |
| 32 // animation ticks. | 32 // animation ticks. |
| 33 bool ComputeScrollDeltaAtTime(base::TimeTicks current, gfx::Vector2dF* delta); | 33 bool ComputeScrollDeltaAtTime(base::TimeTicks current, gfx::Vector2dF* delta); |
| 34 | 34 |
| 35 void ComputeTotalScrollOffset(gfx::Vector2dF& offset) override; |
| 36 |
| 37 bool ResetCurveBySnappedOffset(const gfx::Vector2dF& offset) override; |
| 38 |
| 35 private: | 39 private: |
| 36 const float curve_duration_; | 40 const float curve_duration_; |
| 37 const base::TimeTicks start_timestamp_; | 41 const base::TimeTicks start_timestamp_; |
| 38 | 42 |
| 39 gfx::Vector2dF displacement_ratio_; | 43 gfx::Vector2dF displacement_ratio_; |
| 40 gfx::Vector2dF cumulative_scroll_; | 44 gfx::Vector2dF cumulative_scroll_; |
| 41 base::TimeTicks previous_timestamp_; | 45 base::TimeTicks previous_timestamp_; |
| 42 float time_offset_; | 46 float time_offset_; |
| 43 float position_offset_; | 47 float position_offset_; |
| 44 | 48 |
| 45 DISALLOW_COPY_AND_ASSIGN(FlingCurve); | 49 DISALLOW_COPY_AND_ASSIGN(FlingCurve); |
| 46 }; | 50 }; |
| 47 | 51 |
| 48 } // namespace ui | 52 } // namespace ui |
| 49 | 53 |
| 50 #endif // UI_EVENTS_GESTURES_FLING_CURVE_H_ | 54 #endif // UI_EVENTS_GESTURES_FLING_CURVE_H_ |
| OLD | NEW |