Skip to content

Commit

Permalink
Fix subgraph / cluster node width based off of label
Browse files Browse the repository at this point in the history
  • Loading branch information
yari-dewalt committed Oct 21, 2024
1 parent be3da0b commit fd6b875
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/mermaid-layout-elk/src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export const render = async (
const clusterNode = JSON.parse(JSON.stringify(node));
clusterNode.x = node.offset.posX + node.width / 2;
clusterNode.y = node.offset.posY + node.height / 2;
clusterNode.width = Math.max(clusterNode.width, node.labelData.width);
await insertCluster(subgraphEl, clusterNode);

log.debug('Id (UIO)= ', node.id, node.width, node.shape, node.labels);
Expand Down
1 change: 1 addition & 0 deletions packages/mermaid/src/diagrams/class/classDb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ export const getData = () => {
id: namespace.id,
label: namespace.id,
isGroup: true,
padding: config.class!.padding ?? 16,
// parent node must be one of [rect, roundedWithTitle, noteGroup, divider]
shape: 'rect',
cssStyles: ['fill: none', 'stroke: black'],
Expand Down

0 comments on commit fd6b875

Please sign in to comment.