Merge branch 'develop' into feature/1309_erDiagram_PlantUML
This commit is contained in:
commit
eee9a1661f
|
@ -174,6 +174,14 @@ margin around notes.
|
||||||
Space between messages.
|
Space between messages.
|
||||||
**Default value 35**.
|
**Default value 35**.
|
||||||
|
|
||||||
|
### messageAlign
|
||||||
|
|
||||||
|
Multiline message alignment. Possible values are:
|
||||||
|
|
||||||
|
- left
|
||||||
|
- center **default**
|
||||||
|
- right
|
||||||
|
|
||||||
### mirrorActors
|
### mirrorActors
|
||||||
|
|
||||||
mirror actors under diagram.
|
mirror actors under diagram.
|
||||||
|
|
|
@ -24,6 +24,8 @@ const conf = {
|
||||||
noteMargin: 10,
|
noteMargin: 10,
|
||||||
// Space between messages
|
// Space between messages
|
||||||
messageMargin: 35,
|
messageMargin: 35,
|
||||||
|
// Multiline message alignment
|
||||||
|
messageAlign: 'center',
|
||||||
// mirror actors under diagram
|
// mirror actors under diagram
|
||||||
mirrorActors: false,
|
mirrorActors: false,
|
||||||
// Depending on css styling this might need adjustment
|
// Depending on css styling this might need adjustment
|
||||||
|
@ -230,24 +232,38 @@ const drawMessage = function(elem, startx, stopx, verticalPos, msg, sequenceInde
|
||||||
const g = elem.append('g');
|
const g = elem.append('g');
|
||||||
const txtCenter = startx + (stopx - startx) / 2;
|
const txtCenter = startx + (stopx - startx) / 2;
|
||||||
|
|
||||||
let textElem;
|
let textElems = [];
|
||||||
let counterBreaklines = 0;
|
let counterBreaklines = 0;
|
||||||
let breaklineOffset = 17;
|
let breaklineOffset = 17;
|
||||||
const breaklines = msg.message.split(/<br\s*\/?>/gi);
|
const breaklines = msg.message.split(/<br\s*\/?>/gi);
|
||||||
for (const breakline of breaklines) {
|
for (const breakline of breaklines) {
|
||||||
textElem = g
|
textElems.push(
|
||||||
.append('text') // text label for the x axis
|
g
|
||||||
.attr('x', txtCenter)
|
.append('text') // text label for the x axis
|
||||||
.attr('y', verticalPos - 7 + counterBreaklines * breaklineOffset)
|
.attr('x', txtCenter)
|
||||||
.style('text-anchor', 'middle')
|
.attr('y', verticalPos - 7 + counterBreaklines * breaklineOffset)
|
||||||
.attr('class', 'messageText')
|
.style('text-anchor', 'middle')
|
||||||
.text(breakline.trim());
|
.attr('class', 'messageText')
|
||||||
|
.text(breakline.trim())
|
||||||
|
);
|
||||||
counterBreaklines++;
|
counterBreaklines++;
|
||||||
}
|
}
|
||||||
const offsetLineCounter = counterBreaklines - 1;
|
const offsetLineCounter = counterBreaklines - 1;
|
||||||
const totalOffset = offsetLineCounter * breaklineOffset;
|
const totalOffset = offsetLineCounter * breaklineOffset;
|
||||||
|
|
||||||
let textWidth = (textElem._groups || textElem)[0][0].getBBox().width;
|
let textWidths = textElems.map(function(textElem) {
|
||||||
|
return (textElem._groups || textElem)[0][0].getBBox().width;
|
||||||
|
});
|
||||||
|
let textWidth = Math.max(...textWidths);
|
||||||
|
for (const textElem of textElems) {
|
||||||
|
if (conf.messageAlign === 'left') {
|
||||||
|
textElem.attr('x', txtCenter - textWidth / 2).style('text-anchor', 'start');
|
||||||
|
} else if (conf.messageAlign === 'right') {
|
||||||
|
textElem.attr('x', txtCenter + textWidth / 2).style('text-anchor', 'end');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bounds.bumpVerticalPos(totalOffset);
|
||||||
|
|
||||||
let line;
|
let line;
|
||||||
if (startx === stopx) {
|
if (startx === stopx) {
|
||||||
|
@ -295,9 +311,9 @@ const drawMessage = function(elem, startx, stopx, verticalPos, msg, sequenceInde
|
||||||
} else {
|
} else {
|
||||||
line = g.append('line');
|
line = g.append('line');
|
||||||
line.attr('x1', startx);
|
line.attr('x1', startx);
|
||||||
line.attr('y1', verticalPos);
|
line.attr('y1', verticalPos + totalOffset);
|
||||||
line.attr('x2', stopx);
|
line.attr('x2', stopx);
|
||||||
line.attr('y2', verticalPos);
|
line.attr('y2', verticalPos + totalOffset);
|
||||||
bounds.insert(
|
bounds.insert(
|
||||||
startx,
|
startx,
|
||||||
bounds.getVerticalPos() - 10 + totalOffset,
|
bounds.getVerticalPos() - 10 + totalOffset,
|
||||||
|
|
|
@ -229,6 +229,14 @@ const config = {
|
||||||
*/
|
*/
|
||||||
messageMargin: 35,
|
messageMargin: 35,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multiline message alignment. Possible values are:
|
||||||
|
* * left
|
||||||
|
* * center **default**
|
||||||
|
* * right
|
||||||
|
*/
|
||||||
|
messageAlign: 'center',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mirror actors under diagram.
|
* mirror actors under diagram.
|
||||||
* **Default value true**.
|
* **Default value true**.
|
||||||
|
@ -807,6 +815,7 @@ export default mermaidAPI;
|
||||||
* boxTextMargin:5,
|
* boxTextMargin:5,
|
||||||
* noteMargin:10,
|
* noteMargin:10,
|
||||||
* messageMargin:35,
|
* messageMargin:35,
|
||||||
|
* messageAlign:'center',
|
||||||
* mirrorActors:true,
|
* mirrorActors:true,
|
||||||
* bottomMarginAdj:1,
|
* bottomMarginAdj:1,
|
||||||
* useMaxWidth:true,
|
* useMaxWidth:true,
|
||||||
|
|
Loading…
Reference in New Issue