Crafty.rectManager
Collection of methods for handling rectangles
Methods
Crafty.rectManager.boundingRect()
public Crafty.rectManager.boundingRect(set)
- set
An array of rectangles
- Calculate the common bounding rect of multiple canvas entities.
- Returns coords
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.
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.
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.