mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-18 23:09:49 +02:00
fix for trapezoidal pentagon
This commit is contained in:
@@ -7,15 +7,27 @@ import rough from 'roughjs';
|
||||
export const trapezoidalPentagon = async (parent: SVGAElement, node: Node) => {
|
||||
const { labelStyles, nodeStyles } = styles2String(node);
|
||||
node.labelStyle = labelStyles;
|
||||
const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
|
||||
const nodePadding = node.padding ?? 0;
|
||||
const labelPaddingX = node.look === 'neo' ? nodePadding * 2 : nodePadding;
|
||||
const labelPaddingY = node.look === 'neo' ? nodePadding * 1 : nodePadding;
|
||||
|
||||
const minWidth = 60,
|
||||
minHeight = 20;
|
||||
const w = Math.max(minWidth, bbox.width + (labelPaddingX ?? 0) * 2, node?.width ?? 0);
|
||||
const h = Math.max(minHeight, bbox.height + (labelPaddingY ?? 0) * 2, node?.height ?? 0);
|
||||
if (node.width || node.height) {
|
||||
node.height = (node.height ?? 0) - labelPaddingY * 2;
|
||||
if (node.height < minHeight) {
|
||||
node.height = minHeight;
|
||||
}
|
||||
|
||||
node.width = (node.width ?? 0) - labelPaddingX * 2;
|
||||
if (node.width < minWidth) {
|
||||
node.width = minWidth;
|
||||
}
|
||||
}
|
||||
|
||||
const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
|
||||
|
||||
const w = Math.max(minWidth, bbox.width, node?.width ?? 0) + (labelPaddingX ?? 0) * 2;
|
||||
const h = Math.max(minHeight, bbox.height, node?.height ?? 0) + (labelPaddingY ?? 0) * 2;
|
||||
|
||||
const { cssStyles } = node;
|
||||
// @ts-ignore - rough is not typed
|
||||
|
Reference in New Issue
Block a user