Create an empty rectangle at the origin. All edges and anchor coordinates are set to zero.
Create a rectangle from { left, top, width, height }.
The anchor is placed at the geometric center.
Create a rectangle from edge coordinates. The anchor is placed at the geometric center.
Left edge
Right edge
Top edge
Bottom edge
Create a rectangle with explicit edge and anchor coordinates.
Left edge
Anchor x-coordinate
Right edge
Top edge
Anchor y-coordinate
Bottom edge
Distance from anchor to bottom edge.
Geometric center x-coordinate (ignores anchor).
Geometric center y-coordinate (ignores anchor).
Rectangle height (bottom - top).
Distance from left edge to anchor.
Distance from anchor to right edge.
Distance from top edge to anchor.
Rectangle width (right - left).
Clip this Rect by given Rect. Immutable, return modified copy.
AnchoredRecto to clip this instance with.
Clip this rectangle to the bounds of another rectangle. The anchor is clamped to remain inside the clipped region.
Create copy.
Test whether a point lies inside or on the edges of this rectangle.
Test if edges of this equal with given Rect, ignoring anchorX and anchorY.
Return this rect.
Create an inflated (expanded) copy of this rectangle.
The rectangle edges are moved outward by the given amounts. The anchor position is preserved.
Horizontal expansion applied to left and right edges.
Vertical expansion applied to top and bottom edges.
Defaults to dx.
A new AnchoredRect expanded on all sides.
Create an inset (shrunken) copy of this rectangle.
The rectangle edges are moved inward by the given amounts. The anchor position is preserved.
Horizontal inset applied to left and right edges.
Vertical inset applied to top and bottom edges.
Defaults to dx.
A new AnchoredRect inset from all sides.
Test whether this rectangle intersects another rectangle.
Edge-touching is considered an intersection.
Accepts either an AnchoredRect or a rect-like object
with { left, top, width, height }.
Test whether this rectangle intersects another rectangle.
Edge-touching is considered an intersection.
Accepts either an AnchoredRect or a rect-like object
with { left, top, width, height }.
Move this rect by (dx, dy).
Offset amount in x-direction.
Offset amount in y-direction.
Move this rect by (dx, dy).
Offset amount in x-direction.
Offset amount in y-direction.
Scale Rect. Anchor pos is (anchorX, anchorY). Immutable, returns modified copy.
Scale x-amount.
Scale y-amount. If undefined then scale x-amount is used.
Scaled copy of this AnchoredRect.
Scale this rectangle around its anchor point. Edges are moved relative to the anchor.
Reset this rectangle to the origin. All edges and anchor coordinates are set to zero.
Set rectangle edges. The anchor is repositioned to the geometric center.
Set rectangle edges and anchor explicitly.
Convert to a basic Rect using geometric edges. Anchor information is discarded.
String of this rect.
Union this rect with given Rect.
Union with.
Expand this rectangle to include another rectangle. The anchor is preserved.
StaticcreateCreate rect from basic left, top, width and height arguments.
Left coordinate.
Top coordinate.
Width.
Height.
StaticcreateCreate rect from anchorX, anchorY, width, height arguments.
Center x-coordinate.
Center y-coordinate.
Width.
Height.
StaticcreateCreate rect from sections.
Left section width.
Right section width.
Top section height.
Bottomsection height.
StaticequalsTest if rects are equal.
StaticequalsTest if edges of given rects are equal, ignoring anchorX and anchorY.
StaticoverlapThis method requires strict overlap (edge-touching does NOT count).
StaticoverlapThis method requires strict (horizontal) overlap (edge-touching does NOT count).
Mutable axis-aligned rectangle with an explicit anchor point.
The rectangle is defined by its edges (
left,top,right,bottom) and an independent anchor (anchorX,anchorY) that acts as a logical pivot for scaling, sectioning, and layout operations.The anchor does not need to lie at the geometric center of the rectangle.
All coordinates use the same coordinate space and orientation (top ≤ bottom, left ≤ right).