handlerPointerDown method

  1. @override
bool handlerPointerDown(
  1. PointerDownEvent event
)
override

Implementation

@override
bool handlerPointerDown(PointerDownEvent event) {
  final gEvent = GestureEvent.fromPointerEvent(
    event,
    screenToWorld: gameRef.screenToWorld,
    globalToViewportPosition: gameRef.globalToViewportPosition,
  );
  bool handler = false;

  if (enableDrag && hasGameRef) {
    if (isHud) {
      if (containsPoint(gEvent.screenPosition)) {
        _pointer = gEvent.pointer;
        _startDragOffset = gEvent.screenPosition;
        _startDragPosition = position.clone();
        handler = onStartDrag(gEvent);
      }
    } else {
      if (containsPoint(gEvent.worldPosition)) {
        _pointer = gEvent.pointer;
        _startDragOffset = gEvent.worldPosition;
        _startDragPosition = position.clone();
        handler = onStartDrag(gEvent);
      }
    }
  }

  return handler ? handler : super.handlerPointerDown(event);
}