mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 15:30:03 +02:00
loop/opt/alt/etc titles should always wrap
This commit is contained in:
@@ -459,20 +459,17 @@ function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoop
|
|||||||
bounds.bumpVerticalPos(preMargin);
|
bounds.bumpVerticalPos(preMargin);
|
||||||
let heightAdjust = postMargin;
|
let heightAdjust = postMargin;
|
||||||
if (msg.id && msg.message && loopWidths[msg.id]) {
|
if (msg.id && msg.message && loopWidths[msg.id]) {
|
||||||
if (msg.wrap) {
|
let loopWidth = loopWidths[msg.id].width;
|
||||||
let loopWidth = loopWidths[msg.id].width;
|
let textConf = conf.messageFont();
|
||||||
let textConf = conf.messageFont();
|
msg.message = utils.wrapLabel(`[${msg.message}]`, loopWidth - 2 * conf.wrapPadding, textConf);
|
||||||
msg.message = utils.wrapLabel(`[${msg.message}]`, loopWidth - 2 * conf.wrapPadding, textConf);
|
msg.width = loopWidth;
|
||||||
msg.width = loopWidth;
|
msg.wrap = true;
|
||||||
|
|
||||||
// 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 = textDims.height - conf.labelBoxHeight;
|
||||||
heightAdjust = postMargin + totalOffset;
|
heightAdjust = postMargin + totalOffset;
|
||||||
logger.debug(`${totalOffset} - ${msg.message}`);
|
logger.debug(`${totalOffset} - ${msg.message}`);
|
||||||
} else {
|
|
||||||
msg.message = `[${msg.message}]`;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
addLoopFn(msg);
|
addLoopFn(msg);
|
||||||
bounds.bumpVerticalPos(heightAdjust);
|
bounds.bumpVerticalPos(heightAdjust);
|
||||||
|
Reference in New Issue
Block a user