diff --git a/models/canvas/canvas.js b/models/canvas/canvas.js index 92f6ac6..c30ce7d 100644 --- a/models/canvas/canvas.js +++ b/models/canvas/canvas.js @@ -87,8 +87,8 @@ export function toImage (canvas) { */ export function shortenText (ctx, text, maxWidth, replace = '...') { if (!text) return '' - maxWidth -= ctx.measureText(replace).width if (ctx.measureText(text).width < maxWidth) return text + maxWidth -= ctx.measureText(replace).width while (ctx.measureText(text).width > maxWidth) { text = text.slice(0, -1) }