handleEvent method

  1. @override
void handleEvent (PointerEvent event)
override

Called when a pointer event is routed to this recognizer.

Implementation

@override
void handleEvent(PointerEvent event) {
  assert(_state != _ScaleState.ready);
  bool didChangeConfiguration = false;
  bool shouldStartIfAccepted = false;
  if (event is PointerMoveEvent) {
    final VelocityTracker tracker = _velocityTrackers[event.pointer];
    assert(tracker != null);
    if (!event.synthesized)
      tracker.addPosition(event.timeStamp, event.position);
    _pointerLocations[event.pointer] = event.position;
    shouldStartIfAccepted = true;
  } else if (event is PointerDownEvent) {
    _pointerLocations[event.pointer] = event.position;
    _pointerQueue.add(event.pointer);
    didChangeConfiguration = true;
    shouldStartIfAccepted = true;
  } else if (event is PointerUpEvent || event is PointerCancelEvent) {
    _pointerLocations.remove(event.pointer);
    _pointerQueue.remove(event.pointer);
    didChangeConfiguration = true;
  }

  _updateLines();
  _update();

  if (!didChangeConfiguration || _reconfigure(event.pointer))
    _advanceStateMachine(shouldStartIfAccepted);
  stopTrackingIfPointerNoLongerDown(event);
}