Merge pull request #721 from paulbland/right-angles

Add option for right angles
This commit is contained in:
Tyler Long
2018-12-18 14:04:19 +08:00
committed by GitHub
2 changed files with 13 additions and 4 deletions

View File

@@ -220,9 +220,13 @@ const drawMessage = function (elem, startx, stopx, verticalPos, msg) {
let line let line
if (startx === stopx) { 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}`)
} else {
line = g.append('path') line = g.append('path')
.attr('d', 'M ' + startx + ',' + verticalPos + ' C ' + (startx + 60) + ',' + (verticalPos - 10) + ' ' + (startx + 60) + ',' + .attr('d', 'M ' + startx + ',' + verticalPos + ' C ' + (startx + 60) + ',' + (verticalPos - 10) + ' ' + (startx + 60) + ',' +
(verticalPos + 30) + ' ' + startx + ',' + (verticalPos + 20)) (verticalPos + 30) + ' ' + startx + ',' + (verticalPos + 20))
}
bounds.bumpVerticalPos(30) bounds.bumpVerticalPos(30)
const dx = Math.max(textWidth / 2, 100) const dx = Math.max(textWidth / 2, 100)

View File

@@ -164,7 +164,12 @@ const config = {
* **useMaxWidth** - when this flag is set the height and width is set to 100% and is then scaling with the * **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 * 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 /** ### gantt