Crafty.rectManager

Collection of methods for handling rectangles

Methods

Back to top

Crafty.rectManager.boundingRect()

public Crafty.rectManager.boundingRect(set)
set

An array of rectangles

  • Calculate the common bounding rect of multiple canvas entities.
  • Returns coords
Back to top

Crafty.rectManager.integerBounds()

public Boolean Crafty.rectManager.integerBounds(Object rect)
rect

An object that must have the _x, _y, _w, _h values as properties

[Returns]

An enclosing rectangle with integer coordinates

Calculate the smallest rectangle with integer coordinates that encloses the specified rectangle, modifying the passed object to have those bounds.

Back to top

Crafty.rectManager.mergeSet()

public Object Crafty.rectManager.mergeSet(Object set)
set

an array of rectangular regions

Merge any consecutive, overlapping rects into each other. Its an optimization for the redraw regions.

The order of set isn't strictly meaningful, but overlapping objects will often cause each other to change, and so might be consecutive.

Back to top

Crafty.rectManager.overlap()

public Boolean Crafty.rectManager.overlap(Object rectA, Object rectA)
rectA

An object that must have the _x, _y, _w, _h values as properties

rectB

An object that must have the _x, _y, _w, _h values as properties

[Returns]

true if the rectangles overlap; false otherwise

Checks whether two rectangles overlap.