Rect
A 2D, axis-aligned, floating-point rectangle whose coordinates are relative to a given origin.
Properties
-
bottom
(Number
) –The offset of the bottom edge of this rectangle from the y-axis.
-
height
(Number
) –The distance between the top and bottom edges of this rectangle.
-
left
(Number
) –The offset of the left edge of this rectangle from the x-axis.
-
right
(Number
) –The offset of the right edge of this rectangle from the x-axis.
-
size
(Size
) –The distance between the upper-left corner
-
top
(Number
) –The offset of the top edge of this rectangle from the y-axis.
-
width
(Number
) –The distance between the left and right edges of this rectangle.
Methods
-
copy
–Returns a copy of this object with the specified properties overridden.
-
from_center
–Constructs a rectangle from its center point, width, and height.
-
from_lwth
–Construct a rectangle from its left and top edges,
-
from_points
–Construct the smallest rectangle that encloses the given offsets,
Properties#
size
#
size: Size
The distance between the upper-left corner and the lower-right corner of this rectangle.
Methods#
copy
#
copy(
*,
left: Number | None = None,
top: Number | None = None,
right: Number | None = None,
bottom: Number | None = None,
) -> Rect
Returns a copy of this object with the specified properties overridden.
from_center
#
Constructs a rectangle from its center point, width, and height.
The center
argument is assumed to be an offset from the origin.
from_lwth
#
Construct a rectangle from its left and top edges, its width, and its height.