handleEvent method

void handleEvent(
  1. EventTarget target,
  2. PointerEvent event
)

Implementation

void handleEvent(EventTarget target, PointerEvent event) {
  TouchPoint touchPoint = _toTouchPoint(event);

  if (event is PointerDownEvent) {
    _activeTouches[touchPoint.id] = touchPoint;
    _activeEventTarget[touchPoint.id] = target;

    _handleTouchPoint(target, touchPoint);
  }

  if (event is PointerMoveEvent && _activeEventTarget.containsKey(touchPoint.id)) {
    _activeTouches[touchPoint.id] = touchPoint;
    _handleTouchPoint(_activeEventTarget[touchPoint.id]!, touchPoint);
  }

  if (event is PointerUpEvent && _activeEventTarget.containsKey(touchPoint.id)) {
    _handleTouchPoint(_activeEventTarget[touchPoint.id]!, touchPoint);

    scheduleMicrotask(() {
      _activeEventTarget.remove(touchPoint.id);
      _activeTouches.remove(touchPoint.id);
    });
  }
}