Skip to main content

RelativeRect

@3dverse/livelink v0.8.10


@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

number

bottom

number

width

number = 1

height

number = 1

Returns

RelativeRect

Overrides

Rect.constructor

Properties

left

readonly left: number

Defined in: livelink.js/sources/rendering/surfaces/Rect.ts:8

Inherited from

Rect.left


top

readonly top: number

Defined in: livelink.js/sources/rendering/surfaces/Rect.ts:9

Inherited from

Rect.top


right

readonly right: number

Defined in: livelink.js/sources/rendering/surfaces/Rect.ts:10

Inherited from

Rect.right


bottom

readonly bottom: number

Defined in: livelink.js/sources/rendering/surfaces/Rect.ts:11

Inherited from

Rect.bottom


width

readonly width: number

Defined in: livelink.js/sources/rendering/surfaces/Rect.ts:12

Inherited from

Rect.width


height

readonly height: number

Defined in: livelink.js/sources/rendering/surfaces/Rect.ts:13

Inherited from

Rect.height

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

RelativeRect

The relative rect.

Throws

  • If the element has an invalid size.

Throws

  • If the element is not contained into its parent bounds.