overlaps method

bool overlaps(
  1. LayoutRect other
)

Checks if this rectangle overlaps with another rectangle.

Returns true if the two rectangles have any area in common. Returns false if they are separated horizontally or vertically.

Implementation

bool overlaps(LayoutRect other) {
  if (right <= other.left || other.right <= left) {
    return false;
  }
  if (bottom <= other.top || other.bottom <= top) {
    return false;
  }
  return true;
}