Skip to content

@orillusion/core


Class: Rect ​

Defined in: src/math/Rect.ts:6

Rectangular region

Constructors ​

Constructor ​

new Rect(x?, y?, width?, height?): Rect

Defined in: src/math/Rect.ts:34

Creates a new rectangular area object

Parameters ​

x? ​

number = 0

The x-coordinate of the rectangle

y? ​

number = 0

The y coordinate of the rectangle

width? ​

number = 0

Width of a rectangle

height? ​

number = 0

Height of rectangle

Returns ​

Rect

Properties ​

x ​

x: number

Defined in: src/math/Rect.ts:10

The x-coordinate of the rectangle


y ​

y: number

Defined in: src/math/Rect.ts:15

The y-coordinate of the rectangle


w ​

w: number

Defined in: src/math/Rect.ts:20

Width of a rectangle


h ​

h: number

Defined in: src/math/Rect.ts:25

Height of rectangle

Accessors ​

width ​

Get Signature ​

get width(): number

Defined in: src/math/Rect.ts:44

Width of a rectangle

Returns ​

number

Set Signature ​

set width(v): void

Defined in: src/math/Rect.ts:51

Set the width of the rectangle

Parameters ​
v ​

number

Returns ​

void


height ​

Get Signature ​

get height(): number

Defined in: src/math/Rect.ts:58

Height of rectangle

Returns ​

number

Set Signature ​

set height(v): void

Defined in: src/math/Rect.ts:65

Set the height of the rectangle

Parameters ​
v ​

number

Returns ​

void

Methods ​

pointInRect() ​

static pointInRect(x, y, lt_x, lt_y, rb_x, rb_y): boolean

Defined in: src/math/Rect.ts:79

Whether the point is within the specified area

Parameters ​

x ​

number

x value of point

y ​

number

y value of point

lt_x ​

number

The x value in the upper left corner

lt_y ​

number

The y value in the upper left corner

rb_x ​

number

The x value in the lower right corner

rb_y ​

number

The y value in the lower right corner

Returns ​

boolean


clone() ​

clone(): Rect

Defined in: src/math/Rect.ts:91

Returns a new rectangular area object with the same properties as the current rectangular area

Returns ​

Rect


copy() ​

copy(rect): void

Defined in: src/math/Rect.ts:100

Copy the properties of the source object to this object

Parameters ​

rect ​

Rect

Returns ​

void


copyTo() ​

copyTo(rect): void

Defined in: src/math/Rect.ts:112

Copy the properties of this object to the target object

Parameters ​

rect ​

Rect

Returns ​

void


inner() ​

inner(x, y): boolean

Defined in: src/math/Rect.ts:122

Whether the point is in this area

Parameters ​

x ​

number

x value of point

y ​

number

y value of point

Returns ​

boolean


equal() ​

equal(rectangle): boolean

Defined in: src/math/Rect.ts:134

Whether the current rectangle is equal to the target rectangle

Parameters ​

rectangle ​

Rect

Target rectangle

Returns ​

boolean


equalArea() ​

equalArea(x, y, width, height): boolean

Defined in: src/math/Rect.ts:146

Whether the current rectangle is equal to the target rectangle

Parameters ​

x ​

number

The x value of the rectangle

y ​

number

The y value of the rectangle

width ​

number

Rectangle width

height ​

number

Rectangular height

Returns ​

boolean


equalInnerArea() ​

equalInnerArea(source): boolean

Defined in: src/math/Rect.ts:155

Whether this rectangle overlaps with the target object

Parameters ​

source ​

Rect

Source object

Returns ​

boolean


innerArea() ​

innerArea(source, target): Rect

Defined in: src/math/Rect.ts:180

Returns the overlap of two rectangles

Parameters ​

source ​

Rect

source object

target ​

Rect

target object

Returns ​

Rect


setTo() ​

setTo(x, y, width, height): void

Defined in: src/math/Rect.ts:219

Sets the properties of the rectangle

Parameters ​

x ​

number

x value

y ​

number

y value

width ​

number

Rectangle width

height ​

number

Rectangular height

Returns ​

void