Crafty.DrawManager
Crafty.DrawManager
An internal object manage objects to be drawn and implement the best method of drawing in both DOM and canvas
Back to top
Crafty.DrawManager.onScreen
public Crafty.DrawManager.onScreen(Object rect)
- rect
- A rectangle with field {_x: x_val, _y: y_val, _w: w_val, _h: h_val}
Test if a rectangle is completely in viewport
Back to top
Crafty.DrawManager.merge
public Object Crafty.DrawManager.merge(Object set)
- set
- an array of rectangular regions
Merged into non overlapping rectangular region Its an optimization for the redraw regions.
Back to top
Crafty.DrawManager.add
public Crafty.DrawManager.add(old, current)
- old
- Undocumented
- current
- Undocumented
Calculate the bounding rect of dirty data and add to the register of dirty rectangles
Back to top
Crafty.DrawManager.draw
public Crafty.DrawManager.draw()
- If the number of rects is over 60% of the total number of objects
do the naive method redrawing `Crafty.DrawManager.drawAll`
- Otherwise, clear the dirty regions, and redraw entities overlapping the dirty regions.
See Also
Back to top
Crafty.DrawManager.boundingRect
public Crafty.DrawManager.boundingRect(set)
- set
- Undocumented
- Calculate the common bounding rect of multiple canvas entities.
- Returns coords
Back to top
Crafty.DrawManager.draw
public Crafty.DrawManager.draw()
- If the number of rects is over 60% of the total number of objects
do the naive method redrawing `Crafty.DrawManager.drawAll`
- Otherwise, clear the dirty regions, and redraw entities overlapping the dirty regions.

@craftyjs
#crafty@freenode.net
google groups
louis@craftyjs.com
github