scale-to-pixel.js 369 B

123456789101112
  1. /**
  2. * scale a shape to a given size
  3. */
  4. export function scaleToPixel(el, size, applyScale) {
  5. if (applyScale === void 0) { applyScale = false; }
  6. var _a = el.getBBox(), width = _a.width, height = _a.height;
  7. var scale = size / Math.max(width, height);
  8. if (applyScale)
  9. el.scale(scale);
  10. return scale;
  11. }
  12. //# sourceMappingURL=scale-to-pixel.js.map