fix: do not alter line breaks when drawing text

This commit is contained in:
Johnny Walker 2020-12-11 20:18:37 -05:00
parent c3ce525c6c
commit 0103da13f0
2 changed files with 2 additions and 6 deletions

View File

@ -226,7 +226,6 @@ const drawNote = function(elem, noteModel) {
textObj.anchor = conf.noteAlign;
textObj.textMargin = conf.noteMargin;
textObj.valign = conf.noteAlign;
textObj.wrap = true;
let textElem = drawText(g, textObj);
@ -272,7 +271,7 @@ const actorFont = cnf => {
*/
const drawMessage = function(g, msgModel) {
bounds.bumpVerticalPos(10);
const { startx, stopx, starty, message, type, sequenceIndex, wrap } = msgModel;
const { startx, stopx, starty, message, type, sequenceIndex } = msgModel;
const lines = common.splitBreaks(message).length;
let textDims = utils.calculateTextDimensions(message, messageFont(conf));
const lineHeight = textDims.height / lines;
@ -293,7 +292,6 @@ const drawMessage = function(g, msgModel) {
textObj.valign = conf.messageAlign;
textObj.textMargin = conf.wrapPadding;
textObj.tspan = false;
textObj.wrap = wrap;
drawText(g, textObj);

View File

@ -21,9 +21,7 @@ export const drawRect = function(elem, rectData) {
export const drawText = function(elem, textData) {
let prevTextHeight = 0,
textHeight = 0;
const lines = textData.wrap
? textData.text.split(common.lineBreakRegex)
: [textData.text.replace(common.lineBreakRegex, ' ')];
const lines = textData.text.split(common.lineBreakRegex);
let textElems = [];
let dy = 0;