mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-24 09:49:46 +02:00
fix: calculate text dimensions after wrapping message text
This commit is contained in:
@@ -969,7 +969,6 @@ const buildMessageModel = function(msg, actors) {
|
|||||||
const toIdx = fromBounds[0] < toBounds[0] ? 0 : 1;
|
const toIdx = fromBounds[0] < toBounds[0] ? 0 : 1;
|
||||||
const allBounds = fromBounds.concat(toBounds);
|
const allBounds = fromBounds.concat(toBounds);
|
||||||
const boundedWidth = Math.abs(toBounds[toIdx] - fromBounds[fromIdx]);
|
const boundedWidth = Math.abs(toBounds[toIdx] - fromBounds[fromIdx]);
|
||||||
const msgDims = utils.calculateTextDimensions(msg.message, messageFont(conf));
|
|
||||||
if (msg.wrap && msg.message) {
|
if (msg.wrap && msg.message) {
|
||||||
msg.message = utils.wrapLabel(
|
msg.message = utils.wrapLabel(
|
||||||
msg.message,
|
msg.message,
|
||||||
@@ -977,6 +976,8 @@ const buildMessageModel = function(msg, actors) {
|
|||||||
messageFont(conf)
|
messageFont(conf)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
const msgDims = utils.calculateTextDimensions(msg.message, messageFont(conf));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
width: Math.max(
|
width: Math.max(
|
||||||
msg.wrap ? 0 : msgDims.width + 2 * conf.wrapPadding,
|
msg.wrap ? 0 : msgDims.width + 2 * conf.wrapPadding,
|
||||||
|
Reference in New Issue
Block a user