#5237 Fix for issue with text-centering in state-diagrams with htmlLabels true and subgraph title bkg

This commit is contained in:
Knut Sveidqvist
2024-06-28 08:32:33 +02:00
parent 18e2879867
commit 5e6215d4f2
2 changed files with 5 additions and 5 deletions

View File

@@ -41,6 +41,9 @@ const getStyles = (options: FlowChartStyleOptions) =>
.cluster-label span { .cluster-label span {
color: ${options.titleColor}; color: ${options.titleColor};
} }
.cluster-label span p {
background-color: transparent;
}
.label text,span { .label text,span {
fill: ${options.nodeTextColor || options.textColor}; fill: ${options.nodeTextColor || options.textColor};
@@ -56,7 +59,7 @@ const getStyles = (options: FlowChartStyleOptions) =>
stroke: ${options.nodeBorder}; stroke: ${options.nodeBorder};
stroke-width: 1px; stroke-width: 1px;
} }
.flowchart-label text { .node .label text {
text-anchor: middle; text-anchor: middle;
} }
// .flowchart-label .text-outer-tspan { // .flowchart-label .text-outer-tspan {

View File

@@ -233,10 +233,7 @@ export const createText = async (
structuredText, structuredText,
text ? addSvgBackground : false text ? addSvgBackground : false
); );
svgLabel.setAttribute( svgLabel.setAttribute('style', style.replace('fill:', 'color:'));
'style',
style.replace('fill:', 'color:') + (isNode ? ';text-anchor: middle;' : '')
);
return svgLabel; return svgLabel;
} }
}; };