move method

void move(
  1. PointerMoveEvent e
)

Implementation

void move(PointerMoveEvent e) {
  if (!_fingers.containsKey(e.pointer)) return;
  _fingers[e.pointer] = e.localPosition;
  final start = _fingersAtStart[e.pointer];
  if (start != null && (e.localPosition - start).distance > _tapSlop) {
    _moved = true;
    _longPress?.cancel();
  }
  if (!_moved && _gesture != _Gesture.quickZoom) return;
  final focal = _focal;
  switch (_gesture) {
    case _Gesture.quickZoom:
      if (_pinchZooms) {
        final zoom = _quickStartZoom + (focal.dy - _quickAnchor.dy) / 160;
        _zoomTotal = zoom - _quickStartZoom;
        target.jump(
          MapGestureStep(around: _quickAnchor, zoomBy: zoom - target.zoom),
        );
      }
    case _Gesture.pan:
      if (options.dragPan) {
        _panTotal += focal - _lastFocal;
        target.jump(MapGestureStep(from: _lastFocal, to: focal));
      }
    case _Gesture.turnTilt:
      final d = focal - _lastFocal;
      final turn = _dragTurns ? d.dx * 0.8 : 0.0;
      final tilt = _dragTilts ? -d.dy * 0.45 : 0.0;
      if (turn != 0 || tilt != 0) {
        _turnTotal += turn;
        _tiltTotal += tilt;
        target.jump(MapGestureStep(turn: turn, tilt: tilt));
      }
    case _Gesture.box:
      box.value = Rect.fromPoints(_boxStart, focal);
    case _Gesture.undecided:
      _decide();
      if (_gesture == _Gesture.undecided) return;
      move(e);
      return;
    case _Gesture.tilt:
      final tilt = -(focal.dy - _lastFocal.dy) * 0.45;
      _tiltTotal += tilt;
      target.jump(MapGestureStep(tilt: tilt));
    case _Gesture.pinch:
      _pinch(focal);
  }
  _lastFocal = focal;
  _record(e.timeStamp);
}