contains method

bool contains(
  1. Offset offset
)

Whether the point specified by the given offset (which is assumed to be relative to the origin) lies between the left and right and the top and bottom edges of this rectangle.

Rectangles include their top and left edges but exclude their bottom and right edges.

Implementation

bool contains(Offset offset) {
  return offset.dx >= left && offset.dx < right && offset.dy >= top && offset.dy < bottom;
}