rect.js 419 B

123456789101112131415
  1. "use strict";
  2. var Rect = {
  3. calcRotatedBox: function calcRotatedBox(_ref) {
  4. var width = _ref.width,
  5. height = _ref.height,
  6. rotate = _ref.rotate;
  7. var absRotate = Math.abs(rotate);
  8. return {
  9. width: Math.abs(width * Math.cos(absRotate) + height * Math.sin(absRotate)),
  10. height: Math.abs(height * Math.cos(absRotate) + width * Math.sin(absRotate))
  11. };
  12. }
  13. };
  14. module.exports = Rect;