pointAlong method

void pointAlong(
  1. Ray ray
)

Points along ray (world space; direction need not be normalized).

Implementation

void pointAlong(Ray ray) {
  final captured = _captured;
  if (captured != null) {
    // Captured: route to the pressed surface regardless of occluders.
    // When the ray leaves the surface entirely, hold the last UV so the
    // interaction stays stable at the edge.
    final node = captured.isAttached ? captured.node : null;
    if (node == null) {
      cancel();
      return;
    }
    final hit = raycastNode(
      node,
      ray,
      includeInvisible: true,
      layerMask: 0xFFFFFFFF,
    );
    if (hit?.uv != null) {
      _lastUv = Offset(hit!.uv!.x, hit.uv!.y);
    }
    final pressUv = _pressUv;
    if (pressUv != null) {
      _pressTravel = (_lastUv - pressUv).distance;
    }
    captured.controller.pointerMove(_lastUv, pointer: pointerId);
    _hit = hit;
    return;
  }

  final hit = scene.raycast(
    ray,
    maxDistance: maxDistance,
    layerMask: layerMask,
    where: where,
  );
  _hit = hit;
  WidgetComponent? hovered;
  if (hit != null && (hit.node.layers & interactionMask) != 0) {
    hovered = hit.node.getComponent<WidgetComponent>();
    if (hit.uv != null) {
      _lastUv = Offset(hit.uv!.x, hit.uv!.y);
    }
  }
  if (!identical(hovered, _hovered)) {
    _hovered = hovered;
    (hoverChanged as _HoverNotifier).fire();
  }
}