updated neo look for shaded process and divided process

This commit is contained in:
saurabhg772244
2024-09-24 13:46:25 +05:30
parent 633328c9da
commit 5a1640ee34
2 changed files with 8 additions and 7 deletions

View File

@@ -55,7 +55,7 @@ export const dividedRectangle = async (parent: SVGAElement, node: Node) => {
label.attr(
'transform',
`translate(${x + paddingX / 2 - (bbox.x - (bbox.left ?? 0))}, ${y + rectOffset + paddingY / 2 - (bbox.y - (bbox.top ?? 0))})`
`translate(${x + paddingX - (bbox.x - (bbox.left ?? 0))}, ${y + rectOffset + paddingY - (bbox.y - (bbox.top ?? 0))})`
);
updateNodeBounds(node, polygon);

View File

@@ -8,11 +8,12 @@ export const shadedProcess = async (parent: SVGAElement, node: Node) => {
const { labelStyles, nodeStyles } = styles2String(node);
node.labelStyle = labelStyles;
const { shapeSvg, bbox, label } = await labelHelper(parent, node, getNodeClasses(node));
const halfPadding = node?.padding ?? 0;
const w = Math.max(bbox.width + (node.padding ?? 0) * 2, node?.width ?? 0);
const h = Math.max(bbox.height + (node.padding ?? 0) * 2, node?.height ?? 0);
const x = -bbox.width / 2 - halfPadding;
const y = -bbox.height / 2 - halfPadding;
const paddingX = node.look === 'neo' ? (node.padding ?? 0) * 2 : (node.padding ?? 0);
const paddingY = node.look === 'neo' ? (node.padding ?? 0) * 1 : (node.padding ?? 0);
const w = Math.max(bbox.width + paddingX * 2, node?.width ?? 0);
const h = Math.max(bbox.height + paddingY * 2, node?.height ?? 0);
const x = -bbox.width / 2 - paddingX;
const y = -bbox.height / 2 - paddingY;
const { cssStyles } = node;
// @ts-ignore - rough is not typed
@@ -53,7 +54,7 @@ export const shadedProcess = async (parent: SVGAElement, node: Node) => {
label.attr(
'transform',
`translate(${-w / 2 + 4 + (node.padding ?? 0) - (bbox.x - (bbox.left ?? 0))},${-h / 2 + (node.padding ?? 0) - (bbox.y - (bbox.top ?? 0))})`
`translate(${-w / 2 + 4 + paddingX - (bbox.x - (bbox.left ?? 0))},${-h / 2 + paddingY - (bbox.y - (bbox.top ?? 0))})`
);
updateNodeBounds(node, rect);