Box2d
Table of contents
Public class
class Box2d {}
packages/editor/src/lib/primitives/Box2d.ts
Constructor
Public constructor
Constructs a new instance of the Box2d
class
Name | Description |
---|---|
|
|
|
|
|
|
|
|
Properties
aspectRatio
Public readonly property
get aspectRatio(): number
center
Public property
get center(): Vec2d
set center(v: Vec2d)
Collides
Public static property
static Collides: (A: Box2d, B: Box2d) => boolean
Common
Public static property
static Common: (boxes: Box2d[]) => Box2d
Contains
Public static property
static Contains: (A: Box2d, B: Box2d) => boolean
ContainsPoint
Public static property
static ContainsPoint: (A: Box2d, B: VecLike, margin?: number) => boolean
corners
Public readonly property
get corners(): Vec2d[]
h
Public property
h: number
height
Public property
get height(): number
set height(n: number)
Includes
Public static property
static Includes: (A: Box2d, B: Box2d) => 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(): Vec2d
set point(val: Vec2d)
sides
Public readonly property
get sides(): Array<[Vec2d, Vec2d]>
Sides
Public static property
static Sides: (A: Box2d, inset?: number) => Vec2d[][]
size
Public readonly property
get size(): Vec2d
snapPoints
Public readonly property
get snapPoints(): Vec2d[]
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(): Box2d
collides()
Public method
collides(B: Box2d): boolean
Name | Description |
---|---|
|
|
boolean
contains()
Public method
contains(B: Box2d): boolean
Name | Description |
---|---|
|
|
boolean
containsPoint()
Public method
containsPoint(V: VecLike, margin?: number): boolean
Name | Description |
---|---|
|
|
|
|
boolean
equals()
Public method
equals(other: Box2d | Box2dModel): boolean
Name | Description |
---|---|
|
|
boolean
Equals()
Public static method
static Equals(a: Box2d | Box2dModel, b: Box2d | Box2dModel): boolean
Name | Description |
---|---|
|
|
|
|
boolean
expand()
Public method
expand(A: Box2d): this
Name | Description |
---|---|
|
|
this
Expand()
Public static method
static Expand(A: Box2d, B: Box2d): Box2d
Name | Description |
---|---|
|
|
|
|
Box2d
expandBy()
Public method
expandBy(n: number): this
Name | Description |
---|---|
|
|
this
ExpandBy()
Public static method
static ExpandBy(A: Box2d, n: number): Box2d
Name | Description |
---|---|
|
|
|
|
Box2d
From()
Public static method
static From(box: Box2dModel): Box2d
Name | Description |
---|---|
|
|
Box2d
FromPoints()
Public static method
static FromPoints(points: VecLike[]): Box2d
Name | Description |
---|---|
|
|
Box2d
getHandlePoint()
Public method
getHandlePoint(handle: SelectionCorner | SelectionEdge): Vec2d
Name | Description |
---|---|
|
|
Vec2d
SelectionCorner, SelectionEdge, Vec2d
includes()
Public method
includes(B: Box2d): 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: Box2d,
handle: SelectionCorner | SelectionEdge | string,
dx: number,
dy: number,
isAspectRatioLocked?: boolean
): {
box: Box2d
scaleX: number
scaleY: number
}
Name | Description |
---|---|
|
|
|
|
|
|
|
|
|
|
{
box: Box2d
scaleX: number
scaleY: number
}
Box2d, 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: Box2d): this
Name | Description |
---|---|
|
|
this
snapToGrid()
Public method
snapToGrid(size: number): void
Name | Description |
---|---|
|
|
void
toFixed()
Public method
toFixed(): this
toJson()
Public method
toJson(): Box2dModel
translate()
Public method
translate(delta: VecLike): this
Name | Description |
---|---|
|
|
this
union()
Public method
union(box: Box2dModel): this
Name | Description |
---|---|
|
|
this
zeroFix()
Public method
zeroFix(): this
ZeroFix()
Public static method
static ZeroFix(other: Box2d | Box2dModel): Box2d
Name | Description |
---|---|
|
|
Box2d