zoneAt method

GraphZone zoneAt(
  1. Offset p
)

Implementation

GraphZone zoneAt(Offset p) {
  if (p.dx > bodyRight || p.dy > _panesBottom + spec.x.axisHeight) return const GraphZone(GraphZoneKind.none);
  if (p.dy >= _panesBottom) return const GraphZone(GraphZoneKind.xAxis);
  for (var i = 0; i < spec.panes.length; i++) {
    final plot = plotRect(i);
    if (p.dy >= plot.top && p.dy < plot.bottom) {
      final inPlot = p.dx >= plot.left && p.dx < plot.right;
      return GraphZone(inPlot ? GraphZoneKind.plot : GraphZoneKind.yAxis, i);
    }
  }
  return const GraphZone(GraphZoneKind.none);
}