scale-to-pixel.js 507 B

12345678910111213141516
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.scaleToPixel = void 0;
  4. /**
  5. * scale a shape to a given size
  6. */
  7. function scaleToPixel(el, size, applyScale) {
  8. if (applyScale === void 0) { applyScale = false; }
  9. var _a = el.getBBox(), width = _a.width, height = _a.height;
  10. var scale = size / Math.max(width, height);
  11. if (applyScale)
  12. el.scale(scale);
  13. return scale;
  14. }
  15. exports.scaleToPixel = scaleToPixel;
  16. //# sourceMappingURL=scale-to-pixel.js.map