Returns true if either of the width or height are less than or equal to zero.
Returns true if both the width or height are zero.
Returns true if both width and height values are equal to zero to within 4 decimal places of precision.
Sets the top left coordinates of this rectangle to origin
and returns itself.
Sets the top left coordinates of this rectangle to x
and y
and returns itself.
If y
is undefined then value of x
is used for both dimensions.
Optional
y: numberSets the size of this rectangle to width
and height
and returns itself.
If height
is undefined then value of width
is used for both dimensions.
Optional
height: numberResets origin and size of this Rectangle instance to 0
s and returns itself.
Returns true if this rectangle's origin and size are equal to other
rectangle's origin and size.
Returns true if this rectangle's origin and size are equal to other
rectangle's origin and size to within epsilon
decimal places of precision.
Adds given offsets to a copy of this rectangle and returns the copy.
Adds origin
to both origin coordinates and right
and bottom
to size coordinates of this instance and returns itself.
Adds given values to this rectangle's coordinates and returns this instance.
Moves the x,y origin of the rectangle by the given offset. Returns itself.
Moves the x,y origin of the rectangle by the given amounts. If y
is undefined then x
value is added to both dimensions. Returns itself.
Optional
y: numberScales this rectangle's origin.x
and size.width
by factor.x
and origin.y
and size.height
by factor.y
values. Returns itself.
Scales this rectangle's origin
and size
by factor
. Returns itself.
Scales this rectangle's origin.x
and size.width
by factorX
and origin.y
and size.height
by factorY
values.
Static
fromStatic
fromCreates a new instance of Rectangle from a "bounds" type object where origin coordinate properties are left/top instead of x/y.
Optional
bounds: { left: number; top: number; width: number; height: number }Static
adjustedStatic
adjustStatic
unitedStatic
uniteStatic
translateStatic
scaleStatic
[has
A rectangle type storing x, y, with, & height values. Convenience methods are provided for various operations.
The values are stored as
origin
(Vect2d
type) andsize
(Size
type) properties which can be read or manipulated directly using their respective methods.