handlerPointerMove method

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

Implementation

@override
bool handlerPointerMove(PointerMoveEvent event) {
  final gEvent = GestureEvent.fromPointerEvent(
    event,
    screenToWorld: gameRef.screenToWorld,
  );
  bool canMove = hasGameRef &&
      _startDragPosition != null &&
      enableDrag &&
      gEvent.pointer == _pointer;

  if (canMove) {
    if (isHud) {
      position = Vector2(
        _startDragPosition!.x +
            (gEvent.screenPosition.x - _startDragOffset!.x),
        _startDragPosition!.y +
            (gEvent.screenPosition.y - _startDragOffset!.y),
      );
    } else {
      position = Vector2(
        _startDragPosition!.x +
            (gEvent.worldPosition.x - _startDragOffset!.x),
        _startDragPosition!.y +
            (gEvent.worldPosition.y - _startDragOffset!.y),
      );
    }
    _inMoving = true;
    onMoveDrag(gEvent);
  }
  return super.handlerPointerMove(event);
}