Rectangle
Defined in: util/rectangle.ts:10
The Rectangle class is a utility class used in many different parts of the framework. Please note that there are cases where the framework uses absolute (pixel) measurements, and cases where relative measurements are required (0 being the left/top edges and 1 being the right/bottom edges.)
Please check the documentation of each function to determine the necessary parameters for the Rectangle to be created.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Rectangle():
Rectangle
Returns
Section titled “Returns”Rectangle
Methods
Section titled “Methods”getBottom()
Section titled “getBottom()”getBottom():
number
Defined in: util/rectangle.ts:73
Gets the bottom value
Returns
Section titled “Returns”number
getHeight()
Section titled “getHeight()”getHeight():
number
Defined in: util/rectangle.ts:109
Gets the height value
Returns
Section titled “Returns”number
getLeft()
Section titled “getLeft()”getLeft():
number
Defined in: util/rectangle.ts:37
Gets the left value
Returns
Section titled “Returns”number
getRight()
Section titled “getRight()”getRight():
number
Defined in: util/rectangle.ts:55
Gets the right value
Returns
Section titled “Returns”number
getTop()
Section titled “getTop()”getTop():
number
Defined in: util/rectangle.ts:19
Gets the top value
Returns
Section titled “Returns”number
getWidth()
Section titled “getWidth()”getWidth():
number
Defined in: util/rectangle.ts:91
Gets the width value
Returns
Section titled “Returns”number
setBottom()
Section titled “setBottom()”setBottom(
bottom):Rectangle
Defined in: util/rectangle.ts:78
Sets the bottom value
Parameters
Section titled “Parameters”bottom
Section titled “bottom”number
Returns
Section titled “Returns”Rectangle
setHeight()
Section titled “setHeight()”setHeight(
height):Rectangle
Defined in: util/rectangle.ts:114
Sets the height value
Parameters
Section titled “Parameters”height
Section titled “height”number
Returns
Section titled “Returns”Rectangle
setLeft()
Section titled “setLeft()”setLeft(
left):Rectangle
Defined in: util/rectangle.ts:42
Sets the left value
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”Rectangle
setRight()
Section titled “setRight()”setRight(
right):Rectangle
Defined in: util/rectangle.ts:60
Sets the right value
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”Rectangle
setTop()
Section titled “setTop()”setTop(
top):Rectangle
Defined in: util/rectangle.ts:24
Sets the top value
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”Rectangle
setWidth()
Section titled “setWidth()”setWidth(
width):Rectangle
Defined in: util/rectangle.ts:96
Sets the width value
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”Rectangle
toCoordinateString()
Section titled “toCoordinateString()”toCoordinateString():
string
Defined in: util/rectangle.ts:185
return: string
Returns a comma-separated string containing the coordinates in the order: left, top, right, bottom.
Returns
Section titled “Returns”string
toDimensionString()
Section titled “toDimensionString()”toDimensionString():
string
Defined in: util/rectangle.ts:175
return: string
Returns a comma-separated string containing the width and height values.
Returns
Section titled “Returns”string
toString()
Section titled “toString()”toString(
value?):string
Defined in: util/rectangle.ts:214
return: string
param: (format ?: string)Returns a string representation of the Rectangle object. If the format
optional parameter is omitted, then this is simply the string from
toDimensionString(). Sample usage:
console.log(rect.toString('Origin is at (:left, :top)'));```
You can format the output string by specifying the following markers inthe parameter:- :left- :top- :right- :bottom- :width- :height
#### Parameters
##### value?
`string`
#### Returns
`string`
***
### fromCoordinates()
> `static` **fromCoordinates**(`left`, `top`, `right`, `bottom`): `Rectangle`
Defined in: [util/rectangle.ts:155](https://github.com/SplitmediaLabsLimited/xjs/blob/927d35f9a718e2b9c3aa77475162a90bef8959a5/src/util/rectangle.ts#L155)
param: (left: number, top: number, right: number, bottom: number)return: Rectangle
Creates a rectangle from coordinates. Absolute (pixels)and relative (0-1) dimensions are accepted. Refer to the documentationof each individual function to see which one is necessary.
#### Parameters
##### left
`number`
##### top
`number`
##### right
`number`
##### bottom
`number`
#### Returns
`Rectangle`
***
### fromDimensions()
> `static` **fromDimensions**(`width`, `height`): `Rectangle`
Defined in: [util/rectangle.ts:135](https://github.com/SplitmediaLabsLimited/xjs/blob/927d35f9a718e2b9c3aa77475162a90bef8959a5/src/util/rectangle.ts#L135)
param: (width: number, height: number)return: Rectangle
Creates a rectangle from width and height dimensions. Absolute (pixels)and relative (0-1) dimensions are accepted. Refer to the documentationof each individual function to see which one is necessary.
#### Parameters
##### width
`number`
##### height
`number`
#### Returns
`Rectangle`