Merge pull request #1513 from cmmoran/feature/1483_long_messages

conf.messageFont() would have a different cacheKey based on the cache…
This commit is contained in:
Chris Moran 2020-06-30 07:21:39 -04:00 committed by GitHub
commit ecb4671e0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -250,7 +250,7 @@ const drawNote = function(elem, noteModel) {
const drawMessage = function(g, msgModel) {
const { startx, stopx, starty, message, type, sequenceIndex, wrap } = msgModel;
const lines = message.split(common.lineBreakRegex).length;
let textDims = utils.calculateTextDimensions(message, conf);
let textDims = utils.calculateTextDimensions(message, conf.messageFont());
const lineHeight = textDims.height / lines;
msgModel.height += lineHeight;
@ -968,17 +968,13 @@ const buildMessageModel = function(msg, actors) {
if (msg.wrap && msg.message && !common.lineBreakRegex.test(msg.message)) {
msg.message = utils.wrapLabel(
msg.message,
Math.max(
msgDims.width + 2 * conf.wrapPadding,
boundedWidth + 2 * conf.wrapPadding,
conf.width
),
Math.max(boundedWidth + 2 * conf.wrapPadding, conf.width),
conf.messageFont()
);
}
return {
width: Math.max(
msgDims.width + 2 * conf.wrapPadding,
msg.wrap ? 0 : msgDims.width + 2 * conf.wrapPadding,
boundedWidth + 2 * conf.wrapPadding,
conf.width
),