computeHitSlop function

double computeHitSlop(
  1. PointerDeviceKind kind,
  2. DeviceGestureSettings? settings
)

Determine the appropriate hit slop pixels based on the kind of pointer.

Implementation

double computeHitSlop(PointerDeviceKind kind, DeviceGestureSettings? settings) {
  switch (kind) {
    case PointerDeviceKind.mouse:
      return kPrecisePointerHitSlop;
    case PointerDeviceKind.stylus:
    case PointerDeviceKind.invertedStylus:
    case PointerDeviceKind.unknown:
    case PointerDeviceKind.touch:
    case PointerDeviceKind.trackpad:
      return settings?.touchSlop ?? kTouchSlop;
  }
}