diff --git a/packages/mermaid/src/rendering-util/rendering-elements/shapes/cylinder.ts b/packages/mermaid/src/rendering-util/rendering-elements/shapes/cylinder.ts index 86329f2f3b..2ee2d319fe 100644 --- a/packages/mermaid/src/rendering-util/rendering-elements/shapes/cylinder.ts +++ b/packages/mermaid/src/rendering-util/rendering-elements/shapes/cylinder.ts @@ -54,7 +54,7 @@ export const createInnerCylinderPathD = ( export const cylinder = async (parent: SVGAElement, node: Node) => { const { labelStyles, nodeStyles } = styles2String(node); node.labelStyle = labelStyles; - const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node)); + const { shapeSvg, bbox, label } = await labelHelper(parent, node, getNodeClasses(node)); const w = bbox.width + node.padding; const rx = w / 2; const ry = rx / (2.5 + w / 50); @@ -92,6 +92,8 @@ export const cylinder = async (parent: SVGAElement, node: Node) => { updateNodeBounds(node, cylinder); + label.attr('transform', `translate(${-bbox.width / 2}, ${h / 2 - bbox.height})`); + node.intersect = function (point) { const pos = intersect.rect(node, point); const x = pos.x - (node.x ?? 0);