kangax/fabric.js — pull request #168 by garg (2012-05-28 23:26:36+00:00)
Title: Object#toDataURL was cutting off part of objects at an angle

When Object#toDataURL was called on an object at an angle then it would only grab part of the image as if it was not at an angle leaving out parts of the object that were beyond the rectangle.

There was a 'TODO: should probably use bounding rectangle dimensions instead'. I altered the code to use the width and height of the bounding rectangle, and now toDataURL does grab the entire object even at an angle.

I added Object#getBoundingRectangleWidth and Object#getBoundingRectangleHeight. I also added Array.prototype.min and Array.prototype.max. And finally, I changed toDataURL to use getBoundingRectangleHeight and getBoundingRectangleWidth instead of getHeight and getWidth.

Code criticisms and comments are very welcome. Please let me know if I should change anything.