From cec28464ec4a4e11de12f870e5654b963b04d5c3 Mon Sep 17 00:00:00 2001 From: omkarht Date: Fri, 23 Aug 2024 16:42:10 +0530 Subject: [PATCH] updated tiltedCylinder shape --- .../rendering-elements/shapes/tiltedCylinder.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/mermaid/src/rendering-util/rendering-elements/shapes/tiltedCylinder.ts b/packages/mermaid/src/rendering-util/rendering-elements/shapes/tiltedCylinder.ts index 8eb546f63e..d6092130ea 100644 --- a/packages/mermaid/src/rendering-util/rendering-elements/shapes/tiltedCylinder.ts +++ b/packages/mermaid/src/rendering-util/rendering-elements/shapes/tiltedCylinder.ts @@ -24,7 +24,7 @@ function createInnerPathD(rx: number, ry: number, w: number, h: number) { export const tiltedCylinder = 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 h = bbox.height + node.padding; const ry = h / 2; const rx = ry / (2.5 + h / 50); @@ -59,6 +59,11 @@ export const tiltedCylinder = async (parent: SVGAElement, node: Node) => { tiltedCylinder.selectAll('path').attr('style', nodeStyles); } + label.attr( + 'transform', + `translate(${-(bbox.width / 2) - rx - (bbox.x - (bbox.left ?? 0))}, ${-(bbox.height / 2) - (bbox.y - (bbox.top ?? 0))})` + ); + updateNodeBounds(node, tiltedCylinder); node.intersect = function (point) {