Multiline sequence message

This commit allow user to write multiline messages in sequence diagram.
For instance:

```
sequenceDiagram
	Alice->>+John: Hello John<br>How are you?<br>I mean...<br>Are you OK today?
	Alice->>+John: John, can you hear me?
	John-->>-Alice: Hi Alice, I can hear you!<br>Keep calm!<br>I'm there.
	John-->>-Alice: And I feel great!
```
This commit is contained in:
Raphael Medaer 2020-03-24 18:24:43 +01:00
parent 6ddd394e33
commit d409da2201
No known key found for this signature in database
GPG Key ID: 228A1ACA4E9E5B09
1 changed files with 4 additions and 2 deletions

View File

@ -247,6 +247,8 @@ const drawMessage = function(elem, startx, stopx, verticalPos, msg, sequenceInde
const offsetLineCounter = counterBreaklines - 1;
const totalOffset = offsetLineCounter * breaklineOffset;
bounds.bumpVerticalPos(totalOffset);
let textWidth = (textElem._groups || textElem)[0][0].getBBox().width;
let line;
@ -295,9 +297,9 @@ const drawMessage = function(elem, startx, stopx, verticalPos, msg, sequenceInde
} else {
line = g.append('line');
line.attr('x1', startx);
line.attr('y1', verticalPos);
line.attr('y1', verticalPos + totalOffset);
line.attr('x2', stopx);
line.attr('y2', verticalPos);
line.attr('y2', verticalPos + totalOffset);
bounds.insert(
startx,
bounds.getVerticalPos() - 10 + totalOffset,