ATouchScroller#
Utility object that helps with touchscreen scroll events.
Header: | #include <AUI/Util/ATouchScroller.h> |
CMake: | aui_link(my_target PUBLIC aui::views) |
Detailed Description#
To use this class, you have to pass APointerPressedEvent APointerReleasedEvent to handlePointerPressed and handlePointerReleased methods accordingly. To receive scroll value, use handlePointerMove method.
Public fields and Signals#
INITIAL_ACCELERATION_COEFFICIENT#
float INITIAL_ACCELERATION_COEFFICIENT
Initial acceleration after pointer released is defined by direction of pointer moving and this coefficient
THRESHOLD#
AMetric THRESHOLD
Distance that pointer have to pass in order to treat pointer move events as scroll events.
Public Methods#
gatherKineticScrollValue#
AOptional<glm::ivec2> ATouchScroller::gatherKineticScrollValue()
- 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#
Handles pointer move events.
- Arguments
pos
position of the event in relation to view that used ATouchScroller.- Returns
- the amount of scroll in pixels.
handlePointerPressed#
void ATouchScroller::handlePointerPressed(const APointerPressedEvent& e)
Handles pointer pressed events.
handlePointerReleased#
void ATouchScroller::handlePointerReleased(const APointerReleasedEvent& e)
Handles pointer released events.