findVerdict function

FindVerdict findVerdict(
  1. ResolvedCoord coord, {
  2. required bool tap,
})

A lookup needs the target painted on the viewport; a tap needs it hittable there, and a painted one that is not is covered.

Implementation

FindVerdict findVerdict(ResolvedCoord coord, {required bool tap}) {
  if (!coord.centerOnViewport) return FindVerdict.keepScrolling;
  if (tap ? coord.hittable : coord.painted) return FindVerdict.found;
  return tap && coord.painted ? FindVerdict.covered : FindVerdict.keepScrolling;
}