Utility object that helps with touchscreen scroll events.
More...
#include <AUI/Util/ATouchScroller.h>
|
static float | deceleration () |
|
|
static constexpr float | BASE_DECELERATION = 1600.f |
|
static constexpr float | INITIAL_ACCELERATION_COEFFICIENT = 60.f |
| Initial acceleration after pointer released is defined by direction of pointer moving and this coefficient.
|
|
static constexpr AMetric | THRESHOLD = 8_dp |
| Distance that pointer have to pass in order to treat pointer move events as scroll events.
|
|
To use this class, you have to pass APointerPressedEvent APointerReleasedEvent to handlePointerPressed and handlePointerReleased methods accordingly. To receive scroll value, use handlePointerMove method.
◆ gatherKineticScrollValue()#
AOptional< glm::ivec2 > ATouchScroller::gatherKineticScrollValue |
( |
| ) |
|
|
nodiscard |
- Returns
- std::nullopt if ATouchScroller is not in kinetic scroll state; value for kinetic scroll otherwise.
This method should be called every render frame in order to make continuous kinetic scroll.
◆ handlePointerMove()#
glm::ivec2 ATouchScroller::handlePointerMove |
( |
glm::vec2 | pos | ) |
|
- Parameters
-
pos | position of the event in relation to view that used ATouchScroller. |
- Returns
- the amount of scroll in pixels.