handlerPointerMove method

  1. @override
bool handlerPointerMove(
  1. PointerMoveEvent event
)
override

Implementation

@override
bool handlerPointerMove(PointerMoveEvent event) {
  double distance = _startPoint.distanceTo(event.position.toVector2());
  if (distance > 1) {
    if (_acceptGesture(event, _mouseButton)) {
      double zoom = gameRef.camera.zoom;
      double px = _startPoint.x - event.position.dx;
      double py = _startPoint.y - event.position.dy;
      gameRef.camera.stop();
      gameRef.camera.moveTo(
        _startCameraPosition.translated(
          px / zoom,
          py / zoom,
        ),
      );
    }
  }

  return super.handlerPointerMove(event);
}