Class: Rect
components.Rect
Represents a rectangle with an origin and size.
#
Constructors#
constructor• new Rect(x
, y
, width?
, height?
)
#
ParametersName | Type | Default value |
---|---|---|
x | number | undefined |
y | number | undefined |
width | number | 0 |
height | number | 0 |
#
Defined in#
Properties#
height• height: number
The height of the rectangle.
#
Defined in#
width• width: number
The width of the rectangle.
#
Defined in#
x• x: number
The x-position of the rectangle.
#
Defined in#
y• y: number
The y-position of the rectangle.
#
Defined in#
zeroâ–ª Static
Readonly
zero: Rect
#
Defined in#
Methods#
fromElementâ–¸ Static
fromElement(element
): Rect
Returns a new document-space rectangle from the specified element.
#
ParametersName | Type |
---|---|
element | HTMLElement |
#
Returns#
Defined in#
fromScreenâ–¸ Static
fromScreen(): Rect
Returns a new document-space rectangle from the viewport's bounds.