handlePointerEvent method
Implementation
void handlePointerEvent(PointerEvent event) {
if (event is PointerHoverEvent) {
// Hover does nothing and returns directly.
return;
}
// Stores the current TouchPoint to trigger the corresponding event.
TouchPoint touchPoint = _toTouchPoint(event);
_addPoint(touchPoint);
if (event is PointerDownEvent) {
_gatherEventsInPath();
// The current eventTarget state needs to be stored for use in the callback of GestureRecognizer.
_target = _eventPath.isNotEmpty ? _eventPath.first : null;
if (_target != null) {
_bindEventTargetWithTouchPoint(touchPoint, _target!);
}
}
_handleTouchPoint(touchPoint);
// Make sure gesture event is dispatched after touchstart event.
if (event is PointerDownEvent) {
_addPointerDownEventToMatchedRecognizers(event);
}
if (event is PointerUpEvent || event is PointerCancelEvent) {
_removePoint(touchPoint);
_unbindEventTargetWithTouchPoint(touchPoint);
}
}