Fix different shapes neo look for flowchart

This commit is contained in:
Ashish Jain
2024-06-18 15:33:28 +02:00
parent 0520226b5b
commit 1c1dbe0eb7
9 changed files with 41 additions and 27 deletions

View File

@@ -84,6 +84,10 @@ flowchart
id4>Asymetrical] id4>Asymetrical]
id5{This is the text in the box} id5{This is the text in the box}
id6{{This is the text in the box}} id6{{This is the text in the box}}
id7[/This is the text in the box/]
id8[\This is the text in the box\]
A[/Christmas\]
B[\Christmas/]
</pre </pre
@@ -102,6 +106,11 @@ flowchart
id4>Asymetrical] id4>Asymetrical]
id5{This is the text in the box} id5{This is the text in the box}
id6{{This is the text in the box}} id6{{This is the text in the box}}
id7[/This is the text in the box/]
id8[\This is the text in the box\]
B[/Christmas\]
</pre </pre

View File

@@ -28,10 +28,11 @@ export const hexagon = async (parent: SVGAElement, node: Node): Promise<SVGAElem
const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node)); const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
const f = 4; const f = 4;
const labelPaddingX = node.look === 'neo' ? node.padding * 2 : node.padding; const labelPaddingX = node.look === 'neo' ? node.padding * 3 : node.padding;
const labelPaddingY = node.look === 'neo' ? node.padding * 1.5 : node.padding;
const h = bbox.height + labelPaddingX; const h = bbox.height + labelPaddingX;
const m = h / f; const m = h / f;
const w = bbox.width + 2 * m + node.padding; const w = bbox.width + 2 * m + labelPaddingY;
const points = [ const points = [
{ x: m, y: 0 }, { x: m, y: 0 },
{ x: w - m, y: 0 }, { x: w - m, y: 0 },

View File

@@ -22,9 +22,10 @@ export const createInvertedTrapezoidPathD = (
export const inv_trapezoid = async (parent: SVGAElement, node: Node): Promise<SVGAElement> => { export const inv_trapezoid = async (parent: SVGAElement, node: Node): Promise<SVGAElement> => {
const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node)); const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
const labelPaddingX = node.look === 'neo' ? node.padding * 3 : node.padding;
const w = bbox.width + node.padding; const labelPaddingY = node.look === 'neo' ? node.padding * 1.5 : node.padding;
const h = bbox.height + node.padding; const w = bbox.width + labelPaddingY;
const h = bbox.height + labelPaddingX;
const points = [ const points = [
{ x: h / 6, y: 0 }, { x: h / 6, y: 0 },
{ x: w - h / 6, y: 0 }, { x: w - h / 6, y: 0 },

View File

@@ -22,9 +22,10 @@ export const createLeanLeftPathD = (
export const lean_left = async (parent: SVGAElement, node: Node): Promise<SVGAElement> => { export const lean_left = async (parent: SVGAElement, node: Node): Promise<SVGAElement> => {
const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node)); const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
const labelPaddingX = node.look === 'neo' ? node.padding * 3 : node.padding;
const w = bbox.width + node.padding; const labelPaddingY = node.look === 'neo' ? node.padding * 1.5 : node.padding;
const h = bbox.height + node.padding; const w = bbox.width + labelPaddingY;
const h = bbox.height + labelPaddingX;
const points = [ const points = [
{ x: (2 * h) / 6, y: 0 }, { x: (2 * h) / 6, y: 0 },
{ x: w + h / 6, y: 0 }, { x: w + h / 6, y: 0 },

View File

@@ -23,8 +23,10 @@ export const createLeanRightPathD = (
export const lean_right = async (parent: SVGAElement, node: Node): Promise<SVGAElement> => { export const lean_right = async (parent: SVGAElement, node: Node): Promise<SVGAElement> => {
const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node)); const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
const w = bbox.width + node.padding; const labelPaddingX = node.look === 'neo' ? node.padding * 3 : node.padding;
const h = bbox.height + node.padding; const labelPaddingY = node.look === 'neo' ? node.padding * 1.5 : node.padding;
const w = bbox.width + labelPaddingY;
const h = bbox.height + labelPaddingX;
const points = [ const points = [
{ x: (-2 * h) / 6, y: 0 }, { x: (-2 * h) / 6, y: 0 },
{ x: w - h / 6, y: 0 }, { x: w - h / 6, y: 0 },

View File

@@ -21,9 +21,10 @@ export const rect_left_inv_arrow = async (
node: Node node: Node
): Promise<SVGAElement> => { ): Promise<SVGAElement> => {
const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node)); const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
const labelPadding = node.look === 'neo' ? node.padding * 2 : node.padding; const labelPaddingX = node.look === 'neo' ? node.padding * 3 : node.padding;
const w = bbox.width + labelPadding; const labelPaddingY = node.look === 'neo' ? node.padding * 1.5 : node.padding;
const h = bbox.height + labelPadding; const w = bbox.width + labelPaddingY;
const h = bbox.height + labelPaddingX;
const points = [ const points = [
{ x: -h / 2, y: 0 }, { x: -h / 2, y: 0 },
{ x: w, y: 0 }, { x: w, y: 0 },

View File

@@ -53,12 +53,8 @@ export const createStadiumPathD = (
export const stadium = async (parent: SVGAElement, node: Node) => { export const stadium = async (parent: SVGAElement, node: Node) => {
const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node)); const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
let labelPaddingX = node.padding; const labelPaddingX = node.look === 'neo' ? node.padding * 3 : node.padding;
const labelPaddingY = node.padding; const labelPaddingY = node.look === 'neo' ? node.padding * 1.5 : node.padding;
if (node.look === 'neo') {
labelPaddingX = node.padding ? node.padding * 2 : 0;
}
const h = bbox.height + labelPaddingX; const h = bbox.height + labelPaddingX;
const w = bbox.width + h / 4 + labelPaddingY; const w = bbox.width + h / 4 + labelPaddingY;

View File

@@ -34,10 +34,12 @@ export const createSubroutinePathD = (
export const subroutine = async (parent: SVGAElement, node: Node) => { export const subroutine = async (parent: SVGAElement, node: Node) => {
const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node)); const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
const halfPadding = (node?.padding || 0) / 2; const halfPadding = (node?.padding || 0) / 2;
const w = bbox.width + node.padding; const labelPaddingX = node.look === 'neo' ? node.padding * 3 : node.padding;
const h = bbox.height + node.padding; const labelPaddingY = node.look === 'neo' ? node.padding * 1.5 : node.padding;
const x = -bbox.width / 2 - halfPadding; const w = bbox.width + labelPaddingY;
const y = -bbox.height / 2 - halfPadding; const h = bbox.height + labelPaddingX;
const x = -bbox.width / 2 - labelPaddingX / 2;
const y = -bbox.height / 2 - labelPaddingY / 2;
let rect; let rect;
const { cssStyles } = node; const { cssStyles } = node;
const points = [ const points = [

View File

@@ -22,9 +22,10 @@ export const createTrapezoidPathD = (
export const trapezoid = async (parent: SVGAElement, node: Node): Promise<SVGAElement> => { export const trapezoid = async (parent: SVGAElement, node: Node): Promise<SVGAElement> => {
const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node)); const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
const labelPaddingX = node.look === 'neo' ? node.padding * 3 : node.padding;
const w = bbox.width + node.padding; const labelPaddingY = node.look === 'neo' ? node.padding * 1.5 : node.padding;
const h = bbox.height + node.padding; const w = bbox.width + labelPaddingY;
const h = bbox.height + labelPaddingX;
const points = [ const points = [
{ x: (-2 * h) / 6, y: 0 }, { x: (-2 * h) / 6, y: 0 },
{ x: w + (2 * h) / 6, y: 0 }, { x: w + (2 * h) / 6, y: 0 },