mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:26:21 +02:00
Fix
This commit is contained in:
+1
-6
@@ -221,8 +221,7 @@ module.exports = class CanvasUtil {
|
||||
const word = words[j];
|
||||
if (ctx.measureText(`${currentLine} ${word}`).width <= maxWidth) {
|
||||
currentLine += `${currentLine === '' ? '' : ' '}${word}`;
|
||||
} else if (ctx.measureText(word).width > maxWidth) {
|
||||
if (shouldChunk) {
|
||||
} else if (ctx.measureText(word).width > maxWidth && shouldChunk) {
|
||||
const chunks = [];
|
||||
let currentChunk = '';
|
||||
for (let k = 0; k < word.length; k++) {
|
||||
@@ -248,10 +247,6 @@ module.exports = class CanvasUtil {
|
||||
if (currentLine !== '') lines.push(currentLine.trim());
|
||||
currentLine = word;
|
||||
}
|
||||
} else {
|
||||
lines.push(currentLine.trim());
|
||||
currentLine = word;
|
||||
}
|
||||
}
|
||||
if (currentLine !== '') {
|
||||
lines.push(currentLine.trim());
|
||||
|
||||
Reference in New Issue
Block a user