Make shortened text in canvas take into account the ...

This commit is contained in:
Dragon Fire
2020-05-07 22:34:10 -04:00
parent ff122732bf
commit dd8b8f82bf
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "114.8.1",
"version": "114.8.2",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {
+1 -1
View File
@@ -106,7 +106,7 @@ module.exports = class CanvasUtil {
static shortenText(ctx, text, maxWidth) {
let shorten = false;
while (ctx.measureText(text).width > maxWidth) {
while (ctx.measureText(`${text}...`).width > maxWidth) {
if (!shorten) shorten = true;
text = text.substr(0, text.length - 1);
}