diff --git a/cypress/platform/ash.html b/cypress/platform/ash.html index bcad21c95..b15733d52 100644 --- a/cypress/platform/ash.html +++ b/cypress/platform/ash.html @@ -78,13 +78,20 @@
 flowchart
    node
+   rounded(rounded)
    id1([This is the text in the box])
    id2((circle))
    id3(((double circle)))
    id4>Asymetrical]
    id5{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/]
+   sub[[subroutine]]
+   db[(Database)]
+    
 
       
@@ -96,12 +103,20 @@ config: --- flowchart node + rounded(rounded) id1([This is the text in the box]) id2((circle)) id3(((double circle))) id4>Asymetrical] id5{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\] + sub[[subroutine]] + db[(Database)] + + => { const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node)); - - const w = bbox.width + node.padding; - const h = bbox.height + node.padding; + const labelPaddingX = node.look === 'neo' ? node.padding * 3 : 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 = [ { x: h / 6, y: 0 }, { x: w - h / 6, y: 0 }, diff --git a/packages/mermaid/src/rendering-util/rendering-elements/shapes/leanLeft.ts b/packages/mermaid/src/rendering-util/rendering-elements/shapes/leanLeft.ts index 78b36ddb8..8a3f3ebd4 100644 --- a/packages/mermaid/src/rendering-util/rendering-elements/shapes/leanLeft.ts +++ b/packages/mermaid/src/rendering-util/rendering-elements/shapes/leanLeft.ts @@ -22,9 +22,10 @@ export const createLeanLeftPathD = ( export const lean_left = async (parent: SVGAElement, node: Node): Promise => { const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node)); - - const w = bbox.width + node.padding; - const h = bbox.height + node.padding; + const labelPaddingX = node.look === 'neo' ? node.padding * 3 : 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 = [ { x: (2 * h) / 6, y: 0 }, { x: w + h / 6, y: 0 }, diff --git a/packages/mermaid/src/rendering-util/rendering-elements/shapes/leanRight.ts b/packages/mermaid/src/rendering-util/rendering-elements/shapes/leanRight.ts index 3b3a0b465..53e34a0aa 100644 --- a/packages/mermaid/src/rendering-util/rendering-elements/shapes/leanRight.ts +++ b/packages/mermaid/src/rendering-util/rendering-elements/shapes/leanRight.ts @@ -23,8 +23,10 @@ export const createLeanRightPathD = ( export const lean_right = async (parent: SVGAElement, node: Node): Promise => { const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node)); - const w = bbox.width + node.padding; - const h = bbox.height + node.padding; + const labelPaddingX = node.look === 'neo' ? node.padding * 3 : 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 = [ { x: (-2 * h) / 6, y: 0 }, { x: w - h / 6, y: 0 }, diff --git a/packages/mermaid/src/rendering-util/rendering-elements/shapes/rectLeftInvArrow.ts b/packages/mermaid/src/rendering-util/rendering-elements/shapes/rectLeftInvArrow.ts index 8a3750cd3..7acdb261c 100644 --- a/packages/mermaid/src/rendering-util/rendering-elements/shapes/rectLeftInvArrow.ts +++ b/packages/mermaid/src/rendering-util/rendering-elements/shapes/rectLeftInvArrow.ts @@ -21,9 +21,10 @@ export const rect_left_inv_arrow = async ( node: Node ): Promise => { const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node)); - const labelPadding = node.look === 'neo' ? node.padding * 2 : node.padding; - const w = bbox.width + labelPadding; - const h = bbox.height + labelPadding; + const labelPaddingX = node.look === 'neo' ? node.padding * 3 : 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 = [ { x: -h / 2, y: 0 }, { x: w, y: 0 }, diff --git a/packages/mermaid/src/rendering-util/rendering-elements/shapes/stadium.ts b/packages/mermaid/src/rendering-util/rendering-elements/shapes/stadium.ts index c3f852193..ea9a702e0 100644 --- a/packages/mermaid/src/rendering-util/rendering-elements/shapes/stadium.ts +++ b/packages/mermaid/src/rendering-util/rendering-elements/shapes/stadium.ts @@ -53,12 +53,8 @@ export const createStadiumPathD = ( export const stadium = async (parent: SVGAElement, node: Node) => { const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node)); - let labelPaddingX = node.padding; - const labelPaddingY = node.padding; - - if (node.look === 'neo') { - labelPaddingX = node.padding ? node.padding * 2 : 0; - } + 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 w = bbox.width + h / 4 + labelPaddingY; diff --git a/packages/mermaid/src/rendering-util/rendering-elements/shapes/subroutine.ts b/packages/mermaid/src/rendering-util/rendering-elements/shapes/subroutine.ts index f004c4ff5..378c93883 100644 --- a/packages/mermaid/src/rendering-util/rendering-elements/shapes/subroutine.ts +++ b/packages/mermaid/src/rendering-util/rendering-elements/shapes/subroutine.ts @@ -34,10 +34,12 @@ export const createSubroutinePathD = ( export const subroutine = async (parent: SVGAElement, node: Node) => { const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node)); const halfPadding = (node?.padding || 0) / 2; - const w = bbox.width + node.padding; - const h = bbox.height + node.padding; - const x = -bbox.width / 2 - halfPadding; - const y = -bbox.height / 2 - halfPadding; + const labelPaddingX = node.look === 'neo' ? node.padding * 3 : node.padding; + const labelPaddingY = node.look === 'neo' ? node.padding * 1.5 : node.padding; + const w = bbox.width + labelPaddingY; + const h = bbox.height + labelPaddingX; + const x = -bbox.width / 2 - labelPaddingX / 2; + const y = -bbox.height / 2 - labelPaddingY / 2; let rect; const { cssStyles } = node; const points = [ diff --git a/packages/mermaid/src/rendering-util/rendering-elements/shapes/trapezoid.ts b/packages/mermaid/src/rendering-util/rendering-elements/shapes/trapezoid.ts index 5fcd76d70..3baabe2ec 100644 --- a/packages/mermaid/src/rendering-util/rendering-elements/shapes/trapezoid.ts +++ b/packages/mermaid/src/rendering-util/rendering-elements/shapes/trapezoid.ts @@ -22,9 +22,10 @@ export const createTrapezoidPathD = ( export const trapezoid = async (parent: SVGAElement, node: Node): Promise => { const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node)); - - const w = bbox.width + node.padding; - const h = bbox.height + node.padding; + const labelPaddingX = node.look === 'neo' ? node.padding * 3 : 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 = [ { x: (-2 * h) / 6, y: 0 }, { x: w + (2 * h) / 6, y: 0 }, diff --git a/packages/mermaid/src/styles.ts b/packages/mermaid/src/styles.ts index f50fdff99..e91b4815f 100644 --- a/packages/mermaid/src/styles.ts +++ b/packages/mermaid/src/styles.ts @@ -76,19 +76,19 @@ const getStyles = ( [data-look="neo"].node rect, [data-look="neo"].cluster rect, [data-look="neo"].node polygon { stroke: ${options.useGradient ? 'url(#gradient)' : options.nodeBorder}; - filter: ${options.dropShadow} ); + filter: ${options.dropShadow}; } [data-look="neo"].node rect, [data-look="neo"].node circle, [data-look="neo"].node polygon { stroke: ${options.useGradient ? 'url(#gradient)' : options.nodeBorder}; - filter: ${options.dropShadow} ); + filter: ${options.dropShadow}; } [data-look="neo"].node circle{ stroke: $(options.nodeBorder); stroke: ${options.useGradient ? 'url(#gradient)' : options.nodeBorder}; - filter: ${options.dropShadow} ); + filter: ${options.dropShadow}; } [data-look="neo"].node circle .state-start{