Recognizes touch gestures from a stream of single-point touch samples, and reports them through a single callback.
More...
Recognizes touch gestures from a stream of single-point touch samples, and reports them through a single callback.
This does not replace TouchDriver - feed it the same driver you'd otherwise poll directly, once per loop():
GestureDetector gestures; gestures.onGesture = handleGesture; gestures.isDraggable = [](int16_t x, int16_t y) { ... }; // optional void loop() { gestures.update(touchDriver); }
isDraggable, if set, is checked against the position where a touch started; if it returns true the resulting continuous-move gesture is reported as kDrag, otherwise as kPan/kScroll. Without it, continuous moves are always reported as kPan/kScroll (never kDrag).
pinch/rotate require TouchDriver::getSecondPoint() to return a genuine second simultaneous touch; none of the drivers built into this library can supply one (see TouchDriver::getSecondPoint), so those two gesture types will not fire against them.