RelativeRect
@3dverse/livelink / RelativeRect
Class: RelativeRect
Defined in: livelink.js/sources/rendering/surfaces/Rect.ts:132
Extends
Constructors
new RelativeRect()
new RelativeRect(
__namedParameters
):RelativeRect
Defined in: livelink.js/sources/rendering/surfaces/Rect.ts:180
Parameters
__namedParameters
left
number
= 0
top
number
= 0
right
number
bottom
number
width
number
= 1
height
number
= 1
Returns
Overrides
Properties
left
readonly
left:number
Defined in: livelink.js/sources/rendering/surfaces/Rect.ts:8
Inherited from
top
readonly
top:number
Defined in: livelink.js/sources/rendering/surfaces/Rect.ts:9
Inherited from
right
readonly
right:number
Defined in: livelink.js/sources/rendering/surfaces/Rect.ts:10
Inherited from
bottom
readonly
bottom:number
Defined in: livelink.js/sources/rendering/surfaces/Rect.ts:11
Inherited from
width
readonly
width:number
Defined in: livelink.js/sources/rendering/surfaces/Rect.ts:12
Inherited from
height
readonly
height:number
Defined in: livelink.js/sources/rendering/surfaces/Rect.ts:13
Inherited from
Methods
from_dom_elements()
static
from_dom_elements(params
):RelativeRect
Defined in: livelink.js/sources/rendering/surfaces/Rect.ts:146
Creates a relative rect from the given DOM elements. It calculates the relative position and size of the element inside the parent element.
Parameters
params
element
HTMLElement
The element to get the relative rect from.
parent
HTMLElement
The parent element of the element.
Returns
The relative rect.
Throws
- If the element has an invalid size.
Throws
- If the element is not contained into its parent bounds.