Gestures
This class implements the detection of gestures.
Public Functions
Gestures() | |
Default constructor. | |
void | registerClickEvent(ClickEvent::ClickEventType event, uint16_t x, uint16_t y) |
Register a click event and figure out if this is a drag event, too. | |
bool | registerDragEvent(uint16_t oldX, uint16_t oldY, uint16_t newX, uint16_t newY) |
Register a drag event. | |
void | registerEventListener(UIEventListener & l) |
Register the event listener. | |
void | setDragThreshold(uint16_t val) |
Configure the threshold for reporting drag events. | |
void | tick() |
Has to be called during the timer tick. | |
Public Functions Documentation
Gestures
Gestures | ( | ) |
Default constructor.
Does nothing.
registerClickEvent
void registerClickEvent | ( | ClickEvent::ClickEventType | event , | ||
uint16_t | x , | ||||
uint16_t | y | ||||
) |
Register a click event and figure out if this is a drag event, too.
Parameters:
event | The type of the click event. |
x | The x coordinate of the click event. |
y | The y coordinate of the click event. |
registerDragEvent
bool registerDragEvent | ( | uint16_t | oldX , | ||
uint16_t | oldY , | ||||
uint16_t | newX , | ||||
uint16_t | newY | ||||
) |
Register a drag event.
Parameters:
oldX | The x coordinate of the drag start position (dragged from) |
oldY | The y coordinate of the drag start position (dragged from) |
newX | The x coordinate of the new position (dragged to) |
newY | The y coordinate of the new position (dragged to) |
Returns:
True if the drag exceeds threshold value (and therefore was reported as a drag), or false if the drag did not exceed threshold (and therefore was discarded).
registerEventListener
void registerEventListener | ( | UIEventListener & | l | ) | |
Register the event listener.
Parameters:
l | The EventListener to register. |
setDragThreshold
void setDragThreshold | ( | uint16_t | val | ) | |
Configure the threshold for reporting drag events.
A touch input movement must exceed this value in either axis in order to report a drag. Default value is 0.
Parameters:
val | New threshold value. |
tick
void tick | ( | ) |
Has to be called during the timer tick.