Files
to_docx/client/node_modules/.vite/deps/chunk-YVBSFUGN.js
T
Chen Xiao 0b64e2de94 First commit.
Signed-off-by: Chen Xiao <abigwc@gmail.com>
2026-05-08 14:43:16 +08:00

36 lines
1.2 KiB
JavaScript

import {
configureSvgSize
} from "./chunk-6YWVU24R.js";
import {
__name,
log
} from "./chunk-XOKMXDAB.js";
// node_modules/mermaid/dist/chunks/mermaid.core/chunk-EDXVE4YY.mjs
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-YVBSFUGN.js.map