Skip to main content

Gestures

touchgfx/hal/Gestures.hpp

This class implements the detection of gestures.

Public Functions

Gestures()
Default constructor.
voidregisterClickEvent(ClickEvent::ClickEventType event, uint16_t x, uint16_t y)
Register a click event and figure out if this is a drag event, too.
boolregisterDragEvent(uint16_t oldX, uint16_t oldY, uint16_t newX, uint16_t newY)
Register a drag event.
voidregisterEventListener(UIEventListener & l)
Register the event listener.
voidsetDragThreshold(uint16_t val)
Configure the threshold for reporting drag events.
voidtick()
Has to be called during the timer tick.

Public Functions Documentation

Gestures

Default constructor.

Does nothing.

registerClickEvent

void registerClickEvent(ClickEvent::ClickEventTypeevent ,
uint16_tx ,
uint16_ty
)

Register a click event and figure out if this is a drag event, too.

Parameters:
eventThe type of the click event.
xThe x coordinate of the click event.
yThe y coordinate of the click event.

registerDragEvent

bool registerDragEvent(uint16_toldX ,
uint16_toldY ,
uint16_tnewX ,
uint16_tnewY
)

Register a drag event.

Parameters:
oldXThe x coordinate of the drag start position (dragged from)
oldYThe y coordinate of the drag start position (dragged from)
newXThe x coordinate of the new position (dragged to)
newYThe 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

Register the event listener.

Parameters:
lThe EventListener to register.

setDragThreshold

void setDragThreshold(uint16_tval)

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:
valNew threshold value.

tick

void tick()

Has to be called during the timer tick.