Skip to content

Commit

Permalink
updated tiltedCylinder shape
Browse files Browse the repository at this point in the history
  • Loading branch information
omkarht committed Aug 23, 2024
1 parent a2fba02 commit cec2846
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit cec2846

Please sign in to comment.