From b80bad0a937794edeb9d3287d3c60a28fc03f443 Mon Sep 17 00:00:00 2001 From: "Bland, Paul" Date: Fri, 17 Aug 2018 10:56:15 -0400 Subject: [PATCH 1/3] created option for right angle arrows --- src/diagrams/sequence/sequenceRenderer.js | 10 +++++++--- src/mermaidAPI.js | 7 ++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/diagrams/sequence/sequenceRenderer.js b/src/diagrams/sequence/sequenceRenderer.js index fcf41d28ea..eab7d34bf1 100644 --- a/src/diagrams/sequence/sequenceRenderer.js +++ b/src/diagrams/sequence/sequenceRenderer.js @@ -218,9 +218,13 @@ const drawMessage = function (elem, startx, stopx, verticalPos, msg) { let line if (startx === stopx) { - line = g.append('path') - .attr('d', 'M ' + startx + ',' + verticalPos + ' C ' + (startx + 60) + ',' + (verticalPos - 10) + ' ' + (startx + 60) + ',' + - (verticalPos + 30) + ' ' + startx + ',' + (verticalPos + 20)) + if (conf.rightAngles) { + line = g.append('path').attr('d', `M ${startx},${verticalPos} H ${startx + 75} V ${verticalPos + 25} H ${startx}`) + } else { + line = g.append('path') + .attr('d', 'M ' + startx + ',' + verticalPos + ' C ' + (startx + 60) + ',' + (verticalPos - 10) + ' ' + (startx + 60) + ',' + + (verticalPos + 30) + ' ' + startx + ',' + (verticalPos + 20)) + } bounds.bumpVerticalPos(30) const dx = Math.max(textWidth / 2, 100) diff --git a/src/mermaidAPI.js b/src/mermaidAPI.js index d40c336c42..6fcf4834df 100644 --- a/src/mermaidAPI.js +++ b/src/mermaidAPI.js @@ -153,7 +153,12 @@ const config = { * **useMaxWidth** - when this flag is set the height and width is set to 100% and is then scaling with the * available space if not the absolute space required is used */ - useMaxWidth: true + useMaxWidth: true, + + /** + * **rightAngles** - this will display arrows that start and begin at the same node as right angles, rather than a curve + */ + rightAngles: false }, /** ### gantt From ae8dde981b81f2079534d0eafd8e8341cf3d6ad4 Mon Sep 17 00:00:00 2001 From: "Bland, Paul" Date: Wed, 22 Aug 2018 15:30:12 -0400 Subject: [PATCH 2/3] make path a bit wider --- src/diagrams/sequence/sequenceRenderer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diagrams/sequence/sequenceRenderer.js b/src/diagrams/sequence/sequenceRenderer.js index eab7d34bf1..ee1e2a48ac 100644 --- a/src/diagrams/sequence/sequenceRenderer.js +++ b/src/diagrams/sequence/sequenceRenderer.js @@ -219,7 +219,7 @@ const drawMessage = function (elem, startx, stopx, verticalPos, msg) { let line if (startx === stopx) { if (conf.rightAngles) { - line = g.append('path').attr('d', `M ${startx},${verticalPos} H ${startx + 75} V ${verticalPos + 25} H ${startx}`) + line = g.append('path').attr('d', `M ${startx},${verticalPos} H ${startx + (conf.width/2)} V ${verticalPos + 25} H ${startx}`) } else { line = g.append('path') .attr('d', 'M ' + startx + ',' + verticalPos + ' C ' + (startx + 60) + ',' + (verticalPos - 10) + ' ' + (startx + 60) + ',' + From 42d66fd3d9d1eb6aa08d4ecf14c6790f957b29ab Mon Sep 17 00:00:00 2001 From: "Bland, Paul" Date: Thu, 23 Aug 2018 11:53:04 -0400 Subject: [PATCH 3/3] tweak for lint --- src/diagrams/sequence/sequenceRenderer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/diagrams/sequence/sequenceRenderer.js b/src/diagrams/sequence/sequenceRenderer.js index ee1e2a48ac..ea7b9480b6 100644 --- a/src/diagrams/sequence/sequenceRenderer.js +++ b/src/diagrams/sequence/sequenceRenderer.js @@ -219,7 +219,7 @@ const drawMessage = function (elem, startx, stopx, verticalPos, msg) { let line if (startx === stopx) { if (conf.rightAngles) { - line = g.append('path').attr('d', `M ${startx},${verticalPos} H ${startx + (conf.width/2)} V ${verticalPos + 25} H ${startx}`) + line = g.append('path').attr('d', `M ${startx},${verticalPos} H ${startx + (conf.width / 2)} V ${verticalPos + 25} H ${startx}`) } else { line = g.append('path') .attr('d', 'M ' + startx + ',' + verticalPos + ' C ' + (startx + 60) + ',' + (verticalPos - 10) + ' ' + (startx + 60) + ',' +