handlerPointerHover method

  1. @override
bool handlerPointerHover(
  1. PointerHoverEvent event
)
override

Implementation

@override
bool handlerPointerHover(PointerHoverEvent event) {
  if (!enableMouseGesture) {
    return super.handlerPointerHover(event);
  }
  int pointer = event.pointer;
  Vector2 position = event.localPosition.toVector2();
  Vector2 realPosition = position;
  if (!isHud) {
    realPosition = gameRef.screenToWorld(realPosition);
  }
  onMouseHoverScreen(pointer, position);

  if (containsPoint(realPosition) && !_hoverEnter) {
    _hoverEnter = true;
    onMouseHoverEnter(pointer, position);
  } else if (!containsPoint(realPosition) && _hoverEnter) {
    _hoverEnter = false;
    onMouseHoverExit(pointer, position);
  }

  return super.handlerPointerHover(event);
}