Height.
Height.
Derived sides/center/halfSize. Lazily recomputed after any x/y/w/h change.
Width.
Width.
Top-left x.
Top-left x.
Top-left y.
Top-left y.
New Rect with the same values.
Side of this that rect overlaps from, or "none" if disjoint. Useful for picking a bounce axis.
Approximate equality. Pass withSize: false to compare position only.
Grow on every side by delta (x/y shift in, w/h grow by 2*delta). Pass a negative value to shrink. Mutates and returns this.
Top-left corner as a new Vec2.
Round x and y to the nearest integer. w/h are unchanged. Mutates and returns this.
Width and height as a new Vec2.
Debug string like "Rect [x: 0, y: 0, w: 10, h: 20]".
StaticfromBuild from an HTMLElement (via getBoundingClientRect) or a DOMRect.
Staticfrom
Axis-aligned 2D rectangle (
x,y,w,h).