fix: display annotation text for all stereotypes while preserving styling

on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
This commit is contained in:
darshanr0107
2025-11-07 18:33:09 +05:30
parent ad35a930c6
commit 01ba24c5dc

View File

@@ -36,24 +36,13 @@ export async function textHelper<T extends SVGGraphicsElement>(
annotationGroup = shapeSvg.insert('g').attr('class', 'annotation-group text'); annotationGroup = shapeSvg.insert('g').attr('class', 'annotation-group text');
if (node.annotations.length > 0) { if (node.annotations.length > 0) {
const annotation = node.annotations[0].toLowerCase(); await addText(
let isSupported = false; annotationGroup,
switch (annotation) { { text: `«${node.annotations[0]}»` } as unknown as ClassMember,
case 'interface': 0,
case 'abstract': []
case 'enumeration': );
isSupported = true; annotationGroup.style('opacity', '1');
break;
}
if (!isSupported) {
await addText(
annotationGroup,
{ text: `«${node.annotations[0]}»` } as unknown as ClassMember,
0,
[]
);
annotationGroup.style('opacity', '1');
}
const annotationGroupBBox = annotationGroup.node()!.getBBox(); const annotationGroupBBox = annotationGroup.node()!.getBBox();
annotationGroupHeight = annotationGroupBBox.height; annotationGroupHeight = annotationGroupBBox.height;
} }