mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
updated labelRect shape
This commit is contained in:
parent
b3495219ae
commit
56e9095619
@ -16,7 +16,7 @@ export const roundedRect = async (parent: SVGAElement, node: Node) => {
|
||||
};
|
||||
|
||||
export const labelRect = async (parent: SVGElement, node: Node) => {
|
||||
const { shapeSvg } = await labelHelper(parent, node, 'label');
|
||||
const { shapeSvg, bbox, label } = await labelHelper(parent, node, 'label');
|
||||
|
||||
// log.trace('Classes = ', node.class);
|
||||
// add the rect
|
||||
@ -27,6 +27,10 @@ export const labelRect = async (parent: SVGElement, node: Node) => {
|
||||
const totalHeight = 0.1;
|
||||
rect.attr('width', totalWidth).attr('height', totalHeight);
|
||||
shapeSvg.attr('class', 'label edgeLabel');
|
||||
label.attr(
|
||||
'transform',
|
||||
`translate(${-(bbox.width / 2) - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) - (bbox.y - (bbox.top ?? 0))})`
|
||||
);
|
||||
|
||||
// if (node.props) {
|
||||
// const propKeys = new Set(Object.keys(node.props));
|
||||
|
Loading…
x
Reference in New Issue
Block a user