15#include "AUI/Common/AObject.h"
16#include "AUI/Event/APointerPressedEvent.h"
17#include "AUI/Event/APointerReleasedEvent.h"
19#include "AUI/Event/AScrollEvent.h"
20#include "AUI/Animator/Curves/bezier.h"
29class API_AUI_VIEWS ATouchScroller {
35 static constexpr float BASE_DECELERATION = 1600.f;
42 static float deceleration();
49 ATouchScroller() =
default;
69 glm::ivec2 origin() const noexcept;
81 struct WaitingForThresholdState {
85 struct ScrollingState {
88 glm::vec2 previousPosition = {0.f, 0.f};
89 glm::vec2 currentVelocity = {0.f, 0.f};
90 glm::vec2 prevVelocity = {0.f, 0.f};
91 glm::vec2 prevPrevVelocity = {0.f, 0.f};
92 std::chrono::microseconds timeBetweenFrames;
93 AOptional<std::chrono::high_resolution_clock::time_point> lastFrameTime;
96 struct KineticScrollingState {
97 APointerIndex pointer;
100 float averageTimeDelta;
103 std::chrono::high_resolution_clock::time_point lastFrameTime = std::chrono::high_resolution_clock::now();
106 std::variant<std::nullopt_t, WaitingForThresholdState, ScrollingState, KineticScrollingState> mState = std::nullopt;
Stores dimensions in scalable units (dp, pt, etc...).
Definition AMetric.h:75
Utility wrapper implementing the stack-allocated (fast) optional idiom.
Definition AOptional.h:33
Wrapper class that stores either mouse button index or finger index.
Definition APointerIndex.h:21
Pointing method press event.
Definition APointerPressedEvent.h:21
Pointing method press event.
Definition APointerReleasedEvent.h:19