containsPoint method
Automatic hit testing based on position and size.
Returns true if the given point intersects with this annotation's bounds.
Override this only if you need custom hit testing for complex shapes (e.g., circular annotations, irregular polygons).
Example of custom hit testing for a circular annotation:
@override
bool containsPoint(Offset point) {
final center = Offset(
currentVisualPosition.dx + size.width / 2,
currentVisualPosition.dy + size.height / 2,
);
final radius = size.width / 2;
return (point - center).distance <= radius;
}
Implementation
bool containsPoint(Offset point) {
return bounds.contains(point);
}