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