gesture_curve.h 1.0 KB

12345678910111213141516171819202122232425262728293031
  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.
  4. #ifndef UI_EVENTS_GESTURE_CURVE_H_
  5. #define UI_EVENTS_GESTURE_CURVE_H_
  6. #include "base/time/time.h"
  7. #include "ui/gfx/geometry/vector2d_f.h"
  8. namespace ui {
  9. // An abstraction of curve-based gesture motion, allowing platform-specific
  10. // motion tailoring.
  11. class EVENTS_BASE_EXPORT GestureCurve {
  12. public:
  13. virtual ~GestureCurve() {}
  14. // The output |offset| represents the total movement of the curve from its
  15. // start until |time|.
  16. // The output |velocity| represents the instantenous velocity at |time|.
  17. // Returns false if |time| exceeds the fling duration, in which case
  18. // the terminal offset will be reported.
  19. virtual bool ComputeScrollOffset(base::TimeTicks time,
  20. gfx::Vector2dF* offset,
  21. gfx::Vector2dF* velocity) = 0;
  22. };
  23. } // namespace ui
  24. #endif // UI_EVENTS_GESTURE_CURVE_H_