contains method

bool contains (Offset offset)

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

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

Implementation

bool contains(Offset offset) {
  return offset.dx >= 0.0 && offset.dx < width && offset.dy >= 0.0 && offset.dy < height;
}