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

Side by Side Diff: ui/events/gestures/fling_curve.h

Issue 2767213003: First Implementation of Snapped Points
Patch Set: Rebase and format Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « ui/events/gestures/blink/web_gesture_curve_impl.cc ('k') | ui/events/gestures/fling_curve.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « ui/events/gestures/blink/web_gesture_curve_impl.cc ('k') | ui/events/gestures/fling_curve.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698