34 lines
1.2 KiB
JavaScript
34 lines
1.2 KiB
JavaScript
import {
|
|
__name,
|
|
configureSvgSize,
|
|
log
|
|
} from "./chunk-SJ5HZDIS.js";
|
|
|
|
// ../node_modules/.pnpm/vue-element-plus-x@1.3.7_ro_47c535807434a0797b7704af258a7bca/node_modules/vue-element-plus-x/dist/chunk-SKB7J2MH-BlwHRDiW.js
|
|
var setupViewPortForSVG = __name((svg, padding, cssDiagram, useMaxWidth) => {
|
|
svg.attr("class", cssDiagram);
|
|
const { width, height, x, y } = calculateDimensionsWithPadding(svg, padding);
|
|
configureSvgSize(svg, height, width, useMaxWidth);
|
|
const viewBox = createViewBox(x, y, width, height, padding);
|
|
svg.attr("viewBox", viewBox);
|
|
log.debug(`viewBox configured: ${viewBox} with padding: ${padding}`);
|
|
}, "setupViewPortForSVG");
|
|
var calculateDimensionsWithPadding = __name((svg, padding) => {
|
|
var _a;
|
|
const bounds = ((_a = svg.node()) == null ? void 0 : _a.getBBox()) || { width: 0, height: 0, x: 0, y: 0 };
|
|
return {
|
|
width: bounds.width + padding * 2,
|
|
height: bounds.height + padding * 2,
|
|
x: bounds.x,
|
|
y: bounds.y
|
|
};
|
|
}, "calculateDimensionsWithPadding");
|
|
var createViewBox = __name((x, y, width, height, padding) => {
|
|
return `${x - padding} ${y - padding} ${width} ${height}`;
|
|
}, "createViewBox");
|
|
|
|
export {
|
|
setupViewPortForSVG
|
|
};
|
|
//# sourceMappingURL=chunk-HTGSEQ5R.js.map
|