| 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_ANDROID_SCROLLER_H_ | 5 #ifndef UI_EVENTS_ANDROID_SCROLLER_H_ |
| 6 #define UI_EVENTS_ANDROID_SCROLLER_H_ | 6 #define UI_EVENTS_ANDROID_SCROLLER_H_ |
| 7 | 7 |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "ui/events/events_base_export.h" | 9 #include "ui/events/events_base_export.h" |
| 10 #include "ui/events/gesture_curve.h" | 10 #include "ui/events/gesture_curve.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 explicit Scroller(const Config& config); | 30 explicit Scroller(const Config& config); |
| 31 ~Scroller() override; | 31 ~Scroller() override; |
| 32 | 32 |
| 33 // GestureCurve implementation. | 33 // GestureCurve implementation. |
| 34 bool ComputeScrollOffset(base::TimeTicks time, | 34 bool ComputeScrollOffset(base::TimeTicks time, |
| 35 gfx::Vector2dF* offset, | 35 gfx::Vector2dF* offset, |
| 36 gfx::Vector2dF* velocity) override; | 36 gfx::Vector2dF* velocity) override; |
| 37 | 37 |
| 38 void ComputeTotalScrollOffset(gfx::Vector2dF& offset) override; |
| 39 |
| 40 bool ResetCurveBySnappedOffset(const gfx::Vector2dF& offset) override; |
| 41 |
| 38 // Start scrolling by providing a starting point and the distance to travel. | 42 // Start scrolling by providing a starting point and the distance to travel. |
| 39 // The default value of 250 milliseconds will be used for the duration. | 43 // The default value of 250 milliseconds will be used for the duration. |
| 40 void StartScroll(float start_x, | 44 void StartScroll(float start_x, |
| 41 float start_y, | 45 float start_y, |
| 42 float dx, | 46 float dx, |
| 43 float dy, | 47 float dy, |
| 44 base::TimeTicks start_time); | 48 base::TimeTicks start_time); |
| 45 | 49 |
| 46 // Start scrolling by providing a starting point, the distance to travel, | 50 // Start scrolling by providing a starting point, the distance to travel, |
| 47 // and the duration of the scroll. | 51 // and the duration of the scroll. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 SCROLL_MODE, | 108 SCROLL_MODE, |
| 105 FLING_MODE, | 109 FLING_MODE, |
| 106 }; | 110 }; |
| 107 | 111 |
| 108 bool ComputeScrollOffsetInternal(base::TimeTicks time); | 112 bool ComputeScrollOffsetInternal(base::TimeTicks time); |
| 109 void RecomputeDeltas(); | 113 void RecomputeDeltas(); |
| 110 | 114 |
| 111 double GetSplineDeceleration(float velocity) const; | 115 double GetSplineDeceleration(float velocity) const; |
| 112 base::TimeDelta GetSplineFlingDuration(float velocity) const; | 116 base::TimeDelta GetSplineFlingDuration(float velocity) const; |
| 113 double GetSplineFlingDistance(float velocity) const; | 117 double GetSplineFlingDistance(float velocity) const; |
| 118 double GetSplineVelocityFromDeceleration(float deceleration) const; |
| 119 double GetSplineVelocityFromDistance(float distance) const; |
| 114 | 120 |
| 115 Mode mode_; | 121 Mode mode_; |
| 116 | 122 |
| 117 float start_x_; | 123 float start_x_; |
| 118 float start_y_; | 124 float start_y_; |
| 119 float final_x_; | 125 float final_x_; |
| 120 float final_y_; | 126 float final_y_; |
| 121 | 127 |
| 122 float min_x_; | 128 float min_x_; |
| 123 float max_x_; | 129 float max_x_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 142 float distance_; | 148 float distance_; |
| 143 | 149 |
| 144 float fling_friction_; | 150 float fling_friction_; |
| 145 float deceleration_; | 151 float deceleration_; |
| 146 float tuning_coeff_; | 152 float tuning_coeff_; |
| 147 }; | 153 }; |
| 148 | 154 |
| 149 } // namespace ui | 155 } // namespace ui |
| 150 | 156 |
| 151 #endif // UI_EVENTS_ANDROID_SCROLLER_H_ | 157 #endif // UI_EVENTS_ANDROID_SCROLLER_H_ |
| OLD | NEW |