addAllowedPointerPanZoom method

  1. @override
void addAllowedPointerPanZoom(
  1. PointerPanZoomStartEvent event
)
override

Registers a new pointer pan/zoom that's been checked to be allowed by this gesture recognizer.

Subclasses of GestureRecognizer are supposed to override this method instead of addPointerPanZoom because addPointerPanZoom will be called for each pointer being added while addAllowedPointerPanZoom is only called for pointers that are allowed by this recognizer.

Implementation

@override
void addAllowedPointerPanZoom(PointerPanZoomStartEvent event) {
  super.addAllowedPointerPanZoom(event);
  startTrackingPointer(event.pointer, event.transform);
  _velocityTrackers[event.pointer] = VelocityTracker.withKind(event.kind);
  _initialEventTimestamp = event.timeStamp;
  if (_state == _ScaleState.ready) {
    _state = _ScaleState.possible;
    _initialPanZoomScaleFactor = 1.0;
    _initialPanZoomRotationFactor = 0.0;
  }
}