mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 07:19:41 +02:00
One small refactor to fix activation starty
Ensure a minimum amount of space between wrapped / non-wrapped title text and the next element
This commit is contained in:
@@ -285,10 +285,8 @@ const drawMessage = function(g, msgModel) {
|
|||||||
.append('path')
|
.append('path')
|
||||||
.attr(
|
.attr(
|
||||||
'd',
|
'd',
|
||||||
`M ${startx},${bounds.getVerticalPos() + totalOffset} H ${startx +
|
`M ${startx},${lineStarty} H ${startx +
|
||||||
Math.max(conf.width / 2, textWidth / 2)} V ${bounds.getVerticalPos() +
|
Math.max(conf.width / 2, textWidth / 2)} V ${lineStarty + 25} H ${startx}`
|
||||||
25 +
|
|
||||||
totalOffset} H ${startx}`
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
totalOffset += conf.boxMargin;
|
totalOffset += conf.boxMargin;
|
||||||
@@ -326,8 +324,8 @@ const drawMessage = function(g, msgModel) {
|
|||||||
bounds.getVerticalPos() + 30 + totalOffset
|
bounds.getVerticalPos() + 30 + totalOffset
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
lineStarty = bounds.getVerticalPos() + totalOffset;
|
|
||||||
totalOffset += conf.boxMargin;
|
totalOffset += conf.boxMargin;
|
||||||
|
lineStarty = bounds.getVerticalPos() + totalOffset;
|
||||||
line = g.append('line');
|
line = g.append('line');
|
||||||
line.attr('x1', startx);
|
line.attr('x1', startx);
|
||||||
line.attr('y1', lineStarty);
|
line.attr('y1', lineStarty);
|
||||||
@@ -465,7 +463,7 @@ function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoop
|
|||||||
|
|
||||||
// const lines = msg.message.split(common.lineBreakRegex).length;
|
// const lines = msg.message.split(common.lineBreakRegex).length;
|
||||||
const textDims = utils.calculateTextDimensions(msg.message, textConf);
|
const textDims = utils.calculateTextDimensions(msg.message, textConf);
|
||||||
const totalOffset = textDims.height - conf.labelBoxHeight;
|
const totalOffset = Math.max(textDims.height, conf.labelBoxHeight);
|
||||||
heightAdjust = postMargin + totalOffset;
|
heightAdjust = postMargin + totalOffset;
|
||||||
logger.debug(`${totalOffset} - ${msg.message}`);
|
logger.debug(`${totalOffset} - ${msg.message}`);
|
||||||
}
|
}
|
||||||
@@ -1072,7 +1070,8 @@ const calculateLoopBounds = function(messages, actors) {
|
|||||||
current.from
|
current.from
|
||||||
);
|
);
|
||||||
current.to = Math.max(to.x + msgModel.width / 2, to.x + from.width / 2, current.to);
|
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 {
|
} else {
|
||||||
current.from = Math.min(msgModel.startx, current.from);
|
current.from = Math.min(msgModel.startx, current.from);
|
||||||
current.to = Math.max(msgModel.stopx, current.to);
|
current.to = Math.max(msgModel.stopx, current.to);
|
||||||
|
Reference in New Issue
Block a user