Class: Bounds

Bounds

A representation of an AABB bounding box.

Members

bottom number

the bottom value of the bounds.

height number

the height value of the bounds.

isPositive boolean

Is the bounds positive.

left number

the left value of the bounds.

maxX

Default Value:
  • -Infinity

maxY

Default Value:
  • -Infinity

minX

Default Value:
  • Infinity

minY

Default Value:
  • Infinity

rectangle Rectangle

The bounding rectangle of the bounds.

the right value of the bounds.

top number

the top value of the bounds.

width number

the width value of the bounds.

x number

the x value of the bounds.

y number

the y value of the bounds.

Methods

addBounds (bounds, matrix)

Adds other Bounds.

Name Type Attributes Description
bounds BoundsData

The Bounds to be added

matrix Matrix <optional>

addBoundsMask (mask) void

Adds other Bounds, masked with Bounds.

Name Type Description
mask Bounds

The Bounds to be added.

addFrame (x0, y0, x1, y1, matrix) void

Adds sprite frame

Name Type Attributes Description
x0 number

left X of frame

y0 number

top Y of frame

x1 number

right X of frame

y1 number

bottom Y of frame

matrix Matrix <optional>

addRect (rect, matrix)

Adds a rectangle to the bounds.

Name Type Attributes Description
rect Rectangle

The rectangle to be added.

matrix Matrix <optional>

The matrix to apply to the bounds.

addVertexData (vertexData, beginOffset, endOffset, matrix) void

Adds screen vertices from array

Name Type Attributes Description
vertexData Float32Array

calculated vertices

beginOffset number

begin offset

endOffset number

end offset, excluded

matrix Matrix <optional>

applyMatrix (matrix) void

Adds other Bounds, multiplied with matrix.

Name Type Description
matrix Matrix

The matrix to apply to the bounds.

ceil () this

Ceils the bounds.

Returns:
Type Description
this

clear () this

Clears the bounds and resets.

Returns:
Type Description
this

clone () Bounds

Clones the bounds.

Returns:
Type Description
Bounds

containsPoint (x, y) boolean

Checks if the point is contained within the bounds.

Name Type Description
x number

x coordinate

y number

y coordinate

Returns:
Type Description
boolean

fit (rect) this

Resizes the bounds object to include the given rectangle.

Name Type Description
rect Rectangle

The rectangle to be included.

Returns:
Type Description
this

fitBounds (left, right, top, bottom) this

Resizes the bounds object to include the given bounds.

Name Type Description
left number

The left value of the bounds.

right number

The right value of the bounds.

top number

The top value of the bounds.

bottom number

The bottom value of the bounds.

Returns:
Type Description
this

isEmpty () boolean

Checks if bounds are empty.

Returns:
Type Description
boolean
  • True if empty.

pad (paddingX, paddingY) this

Pads bounds object, making it grow in all directions. If paddingY is omitted, both paddingX and paddingY will be set to paddingX.

Name Type Description
paddingX number

The horizontal padding amount.

paddingY number

The vertical padding amount.

Returns:
Type Description
this

scale (x, y) this

Scales the bounds by the given values

Name Type Description
x number

The X value to scale by.

y number

The Y value to scale by.

Returns:
Type Description
this

set (x0, y0, x1, y1)

Sets the bounds.

Name Type Description
x0 number

left X of frame

y0 number

top Y of frame

x1 number

right X of frame

y1 number

bottom Y of frame