hitTest method

  1. @override
bool hitTest(
  1. DiagramPoint point, {
  2. required double tolerance,
})
override

Picking with a caller tolerance. Closed outlines pick their interior only; stroke-like outlines widen their stroke to tolerance instead of the fixed diagramStrokeHitTolerance used by contains.

Implementation

@override
bool hitTest(DiagramPoint point, {required double tolerance}) {
  if (inkHull.isNotEmpty && pointInPolygon(point, inkHull)) return true;
  if (_nearPolyline(point, points, tolerance)) return true;
  return points.length >= 3 && pointInPolygon(point, points);
}