From c153d0455fdc89abd49f61d117a64aac1f3748b0 Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist Date: Tue, 17 Dec 2024 16:28:38 +0100 Subject: [PATCH] #5574 Fixed issue linkStyles --- packages/mermaid/src/diagrams/flowchart/flowDb.ts | 3 --- .../mermaid/src/rendering-util/rendering-elements/edges.js | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/mermaid/src/diagrams/flowchart/flowDb.ts b/packages/mermaid/src/diagrams/flowchart/flowDb.ts index ccb8a8e94..ffe46d398 100644 --- a/packages/mermaid/src/diagrams/flowchart/flowDb.ts +++ b/packages/mermaid/src/diagrams/flowchart/flowDb.ts @@ -297,9 +297,6 @@ export const updateLink = function (positions: ('default' | number)[], style: st if (pos === 'default') { edges.defaultStyle = style; } else { - // if (utils.isSubstringInArray('fill', style) === -1) { - // style.push('fill:none'); - // } edges[pos].style = style; // if edges[pos].style does have fill not set, set it to none if ( diff --git a/packages/mermaid/src/rendering-util/rendering-elements/edges.js b/packages/mermaid/src/rendering-util/rendering-elements/edges.js index 2581d342f..649686c0c 100644 --- a/packages/mermaid/src/rendering-util/rendering-elements/edges.js +++ b/packages/mermaid/src/rendering-util/rendering-elements/edges.js @@ -429,7 +429,6 @@ export const insertEdge = function (elem, edge, clusterDb, diagramType, startNod let pointsHasChanged = false; const tail = startNode; var head = endNode; - const edgeClassStyles = []; for (const key in edge.cssCompiledStyles) { if (isLabelStyle(key)) { @@ -510,6 +509,7 @@ export const insertEdge = function (elem, edge, clusterDb, diagramType, startNod let svgPath; let linePath = lineFunction(lineData); const edgeStyles = Array.isArray(edge.style) ? edge.style : [edge.style]; + if (edge.look === 'handDrawn') { const rc = rough.svg(elem); Object.assign([], lineData); @@ -531,7 +531,7 @@ export const insertEdge = function (elem, edge, clusterDb, diagramType, startNod elem.node().appendChild(svgPath.node()); } else { const stylesFromClasses = edgeClassStyles.join(';'); - const styles = edge.edgeStyles ? edgeStyles.reduce((acc, style) => acc + ';' + style, '') : ''; + const styles = edgeStyles ? edgeStyles.reduce((acc, style) => acc + style + ';', '') : ''; let animationClass = ''; if (edge.animate) { animationClass = ' edge-animation-fast'; @@ -550,7 +550,7 @@ export const insertEdge = function (elem, edge, clusterDb, diagramType, startNod (edge.classes ? ' ' + edge.classes : '') + (animationClass ? animationClass : '') ) - .attr('style', stylesFromClasses + ';' + styles); + .attr('style', stylesFromClasses ? stylesFromClasses + ';' + styles + ';' : styles); } // DEBUG code, DO NOT REMOVE