From 2ffb2988bfad97a9a855e3d5cfbccfa98671a381 Mon Sep 17 00:00:00 2001 From: chris moran Date: Wed, 1 Jul 2020 05:34:53 -0400 Subject: [PATCH] One small refactor to fix activation starty Ensure a minimum amount of space between wrapped / non-wrapped title text and the next element --- src/diagrams/sequence/sequenceRenderer.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/diagrams/sequence/sequenceRenderer.js b/src/diagrams/sequence/sequenceRenderer.js index 057fb39f4..30f0925b3 100644 --- a/src/diagrams/sequence/sequenceRenderer.js +++ b/src/diagrams/sequence/sequenceRenderer.js @@ -285,10 +285,8 @@ const drawMessage = function(g, msgModel) { .append('path') .attr( 'd', - `M ${startx},${bounds.getVerticalPos() + totalOffset} H ${startx + - Math.max(conf.width / 2, textWidth / 2)} V ${bounds.getVerticalPos() + - 25 + - totalOffset} H ${startx}` + `M ${startx},${lineStarty} H ${startx + + Math.max(conf.width / 2, textWidth / 2)} V ${lineStarty + 25} H ${startx}` ); } else { totalOffset += conf.boxMargin; @@ -326,8 +324,8 @@ const drawMessage = function(g, msgModel) { bounds.getVerticalPos() + 30 + totalOffset ); } else { - lineStarty = bounds.getVerticalPos() + totalOffset; totalOffset += conf.boxMargin; + lineStarty = bounds.getVerticalPos() + totalOffset; line = g.append('line'); line.attr('x1', startx); line.attr('y1', lineStarty); @@ -465,7 +463,7 @@ function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoop // const lines = msg.message.split(common.lineBreakRegex).length; const textDims = utils.calculateTextDimensions(msg.message, textConf); - const totalOffset = textDims.height - conf.labelBoxHeight; + const totalOffset = Math.max(textDims.height, conf.labelBoxHeight); heightAdjust = postMargin + totalOffset; logger.debug(`${totalOffset} - ${msg.message}`); } @@ -1072,7 +1070,8 @@ const calculateLoopBounds = function(messages, actors) { current.from ); current.to = Math.max(to.x + msgModel.width / 2, to.x + from.width / 2, current.to); - current.width = Math.max(current.width, Math.abs(current.to - current.from)); + current.width = + Math.max(current.width, Math.abs(current.to - current.from)) - conf.labelBoxWidth; } else { current.from = Math.min(msgModel.startx, current.from); current.to = Math.max(msgModel.stopx, current.to);