From 44c71999996f64f6dcb41ff7e01b7e9250f66fd4 Mon Sep 17 00:00:00 2001 From: Kyle <41976328+ImKyle4815@users.noreply.github.com> Date: Fri, 4 Feb 2022 10:57:12 -0800 Subject: [PATCH] Update creator-23.js --- js/creator-23.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/creator-23.js b/js/creator-23.js index 747b322c..3ff2f756 100644 --- a/js/creator-23.js +++ b/js/creator-23.js @@ -1218,6 +1218,7 @@ function writeText(textObject, targetContext) { wordToWrite = word; } } + //if the word goes past the max line width, go to the next line if (wordToWrite && lineContext.measureText(wordToWrite).width + currentX >= textWidth && textArcRadius == 0) { if (textOneLine && startingTextSize > 1) { //doesn't fit... try again at a smaller text size? @@ -1226,6 +1227,7 @@ function writeText(textObject, targetContext) { } newLine = true; } + //if we need a new line, go to the next line if ((newLine && !textOneLine) || splitText.indexOf(word) == splitText.length - 1) { var horizontalAdjust = 0 if (textAlign == 'center') { @@ -1259,7 +1261,8 @@ function writeText(textObject, targetContext) { newLineSpacing = (textObject.lineSpacing || 0) * textSize; newLine = false; } - if (wordToWrite && (currentX != 0 || wordToWrite != ' ') && !textManaCost) { + //if there's a word to write, it's not a space on a new line, and it's allowed to write words, then we write the word + if (wordToWrite && (currentX != startingCurrentX || wordToWrite != ' ') && !textManaCost) { if (textArcRadius > 0) { lineContext.fillTextArc(wordToWrite, currentX + canvasMargin, canvasMargin + textSize * textFontHeightRatio + lineY, textArcRadius, textArcStart, currentX, textOutlineWidth); } else {