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"
35 static constexpr float BASE_DECELERATION = 1600.f;
40 static constexpr float INITIAL_ACCELERATION_COEFFICIENT = 60.f;
42 static float deceleration();
47 static constexpr AMetric THRESHOLD = 8_dp;
66 glm::ivec2 handlePointerMove(glm::vec2 pos);
69 glm::ivec2 origin() const noexcept;
78 AOptional<glm::ivec2> gatherKineticScrollValue();
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;
96 struct KineticScrollingState {
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:32
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