hitTest method

  1. @nonVirtual
Iterable<Node> hitTest(
  1. Vector2 point
)

Finds every enabled node in this subtree whose hit area contains point, per containsPoint, topmost first.

Children are searched in reverse priority order before this node's own hit area, mirroring reverse paint order.

Unlike add, remove, and priority, enabled takes effect immediately even on a mounted node. A handler invoked mid-walk that disables an unvisited node will affect that same walk.

TODO: Should it really do that? Is enabled actually a tree operation?

Implementation

@nonVirtual
Iterable<Node> hitTest(Vector2 point) sync* {
  if (!enabled) return;
  final children = _egg?.nodes;

  if (children != null && children.isNotEmpty) {
    for (final child in children.reversed) {
      yield* child.hitTest(point);
    }
  }

  if (containsPoint(point)) yield this;
}