hitTestShape method

ResolvedShape? hitTestShape(
  1. DiagramPoint point, {
  2. bool where(
    1. ResolvedShape shape
    )?,
})

Implementation

ResolvedShape? hitTestShape(
  DiagramPoint point, {
  bool Function(ResolvedShape shape)? where,
}) {
  final candidates = spatialIndex._query(
    DiagramRect.fromCenter(
      center: point,
      size: const DiagramSize(0.001, 0.001),
    ),
  );
  for (final element in candidates.reversed) {
    if (element is ResolvedShape &&
        element.bounds.contains(point) &&
        _insideClippingAncestors(element, point) &&
        element.hitTest(point) &&
        (where == null || where(element))) {
      return element;
    }
  }
  return null;
}