Box
Table of contents
class Box {}
Constructs a new instance of the Box
class
Parameters
Name | Description |
---|---|
|
|
|
|
|
|
|
|
Properties
static Collides: (A: Box, B: Box) => boolean
static Common: (boxes: Box[]) => Box
static Contains: (A: Box, B: Box) => boolean
static ContainsPoint: (A: Box, B: VecLike, margin?: number) => boolean
static Includes: (A: Box, B: Box) => boolean
static Sides: (A: Box, inset?: number) => Vec[][]
get aspectRatio(): number
get center(): Vec
set center(v: Vec)
get corners(): Vec[]
get cornersAndCenter(): Vec[]
h: number
get height(): number
set height(n: number)
get maxX(): number
get maxY(): number
get midX(): number
get midY(): number
get minX(): number
set minX(n: number)
get minY(): number
set minY(n: number)
get point(): Vec
set point(val: Vec)
get sides(): Array<[Vec, Vec]>
get size(): Vec
w: number
get width(): number
set width(n: number)
x: number
y: number
Methods
static Equals(a: Box | BoxModel, b: Box | BoxModel): boolean
Parameters
Returns
boolean
static Expand(A: Box, B: Box): Box
Parameters
Returns
Box
static ExpandBy(A: Box, n: number): Box
Parameters
Name | Description |
---|---|
|
|
|
|
Returns
Box
static From(box: BoxModel): Box
Parameters
Name | Description |
---|---|
|
|
Returns
Box
static FromCenter(center: VecLike, size: VecLike): Box
Parameters
Returns
Box
static FromPoints(points: VecLike[]): Box
Parameters
Name | Description |
---|---|
|
|
Returns
Box
static Resize(
box: Box,
handle: SelectionCorner | SelectionEdge | string,
dx: number,
dy: number,
isAspectRatioLocked?: boolean
): {
box: Box
scaleX: number
scaleY: number
}
Parameters
Name | Description |
---|---|
|
|
|
|
|
|
|
|
|
|
Returns
{
box: Box
scaleX: number
scaleY: number
}
static ZeroFix(other: Box | BoxModel): Box
Parameters
Returns
Box
clone(): Box
collides(B: Box): boolean
Parameters
Name | Description |
---|---|
|
|
Returns
boolean
contains(B: Box): boolean
Parameters
Name | Description |
---|---|
|
|
Returns
boolean
containsPoint(V: VecLike, margin?: number): boolean
Parameters
Name | Description |
---|---|
|
|
|
|
Returns
boolean
equals(other: Box | BoxModel): boolean
Parameters
Returns
boolean
expand(A: Box): this
Parameters
Name | Description |
---|---|
|
|
Returns
this
expandBy(n: number): this
Parameters
Name | Description |
---|---|
|
|
Returns
this
getHandlePoint(handle: SelectionCorner | SelectionEdge): Vec
Parameters
Name | Description |
---|---|
|
|
Returns
Vec
includes(B: Box): boolean
Parameters
Name | Description |
---|---|
|
|
Returns
boolean
resize(
handle: SelectionCorner | SelectionEdge | string,
dx: number,
dy: number
): void
Parameters
Name | Description |
---|---|
|
|
|
|
|
|
Returns
void
scale(n: number): this
Parameters
Name | Description |
---|---|
|
|
Returns
this
set(x?: number, y?: number, w?: number, h?: number): this
Parameters
Name | Description |
---|---|
|
|
|
|
|
|
|
|
Returns
this
setTo(B: Box): this
Parameters
Name | Description |
---|---|
|
|
Returns
this
snapToGrid(size: number): void
Parameters
Name | Description |
---|---|
|
|
Returns
void
toFixed(): this
toJson(): BoxModel
translate(delta: VecLike): this
Parameters
Name | Description |
---|---|
|
|
Returns
this
union(box: BoxModel): this
Parameters
Name | Description |
---|---|
|
|
Returns
this
zeroFix(): this