Skip to content

Commit

Permalink
fix: centrally align text in cylinder shape
Browse files Browse the repository at this point in the history
  • Loading branch information
omkarht committed Aug 1, 2024
1 parent 1d3f214 commit 3d789a0
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3d789a0

Please sign in to comment.