fix: calculate text dimensions after wrapping message text
This commit is contained in:
parent
0103da13f0
commit
469a726285
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue