craftyjs/Crafty — pull request #485 by starwed (2013-06-10 17:14:56+00:00)
Title: Add resize event and change hitbox on resize

This patch:
* Adds a resize event to "2D" triggered when h or w change
* Allows "Collision" hitboxes to track an entities shape through that event
* Changes collision(polygon) to rotate the polygon before attaching it
* Fixes some errors in calculating the MBR when a rotated entity was resized
* Adds some tests for resizing rotated objects

The changes to "Collision" are not backwards compatible, but they make it act how almost everyone *expects* it to act.

Currently, when you resize a rotated entity, the MBR size is adjusted as if it weren't rotated. To fix this, I factored out the calculation of the MBR into a separate function, and call it on a resize.

The DebugCanvas changes I made in a separate PR were vital to getting this working!