hitTestHandle method

int? hitTestHandle(
  1. Offset pos,
  2. Rect bounds,
  3. PriceRange priceRange,
  4. CoordinateConverter converter, {
  5. double threshold = 12.0,
})

Checks if pos falls within threshold pixels of any handle on this drawing.

Implementation

int? hitTestHandle(
  Offset pos,
  Rect bounds,
  PriceRange priceRange,
  CoordinateConverter converter, {
  double threshold = 12.0,
}) {
  final handles = getHandleOffsets(bounds, priceRange, converter);
  for (int i = 0; i < handles.length; i++) {
    if ((pos - handles[i]).distance <= threshold) {
      return i;
    }
  }
  return null;
}