mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix
This commit is contained in:
+2
-1
@@ -201,7 +201,8 @@ module.exports = class CanvasUtil {
|
|||||||
const lines = text.split('\n');
|
const lines = text.split('\n');
|
||||||
let currentY = y;
|
let currentY = y;
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
ctx.fillText(line, x, currentY, maxLen);
|
if (maxLen) ctx.fillText(line, x, currentY, maxLen);
|
||||||
|
else ctx.fillText(line, x, currentY);
|
||||||
const metrics = ctx.measureText(line);
|
const metrics = ctx.measureText(line);
|
||||||
currentY += metrics.emHeightAscent + metrics.emHeightDescent;
|
currentY += metrics.emHeightAscent + metrics.emHeightDescent;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user