add hw2
This commit is contained in:
35
node_modules/mermaid/dist/chunks/mermaid.esm/chunk-WDWNAAEG.mjs
generated
vendored
Normal file
35
node_modules/mermaid/dist/chunks/mermaid.esm/chunk-WDWNAAEG.mjs
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import {
|
||||
configureSvgSize
|
||||
} from "./chunk-6PHMZWEM.mjs";
|
||||
import {
|
||||
log
|
||||
} from "./chunk-2LXNVE6Q.mjs";
|
||||
import {
|
||||
__name
|
||||
} from "./chunk-DLQEHMXD.mjs";
|
||||
|
||||
// src/rendering-util/setupViewPortForSVG.ts
|
||||
var setupViewPortForSVG = /* @__PURE__ */ __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 = /* @__PURE__ */ __name((svg, padding) => {
|
||||
const bounds = svg.node()?.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 = /* @__PURE__ */ __name((x, y, width, height, padding) => {
|
||||
return `${x - padding} ${y - padding} ${width} ${height}`;
|
||||
}, "createViewBox");
|
||||
|
||||
export {
|
||||
setupViewPortForSVG
|
||||
};
|
||||
Reference in New Issue
Block a user