contains method

  1. @override
bool contains(
  1. Offset position
)
override

Implementation

@override
bool contains(Offset position) {
  late Rect segmentRegion;
  if (series.isTransposed) {
    final Offset start = series.yAxis != null && series.yAxis!.isInversed
        ? points[0]
        : points[1];
    final Offset end = series.yAxis != null && series.yAxis!.isInversed
        ? points[1]
        : points[0];
    segmentRegion = Rect.fromLTRB(
        start.dx, start.dy - hiloPadding, end.dx, end.dy + hiloPadding);
  } else {
    final Offset start = series.yAxis != null && series.yAxis!.isInversed
        ? points[1]
        : points[0];
    final Offset end = series.yAxis != null && series.yAxis!.isInversed
        ? points[0]
        : points[1];
    segmentRegion = Rect.fromLTRB(
        start.dx - hiloPadding, start.dy, end.dx + hiloPadding, end.dy);
  }

  if (segmentRegion.contains(position)) {
    return true;
  }
  return false;
}