mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-18 23:09:49 +02:00
#5237 Fix for issue with text-centering in state-diagrams with htmlLabels true and subgraph title bkg
This commit is contained in:
@@ -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 {
|
||||||
|
@@ -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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user