hit method

bool hit(
  1. Moving d
)

collision detection with another user widget

Implementation

bool hit(Moving d) {
  return (d.left > left && d.left < right ||
          d.right > left && d.right < right) &&
      (d.top > top && d.top < bottom || d.bottom > top && d.bottom < bottom);
}