remove special chars for 7seg font

pull/3592/head
Freubert 2024-09-27 11:00:23 +02:00 committed by GitHub
parent f3db296830
commit a0459c06b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -38,7 +38,7 @@ let clockInfoDraw = (itm, info, options) => {
if (info.img) g.drawImage(info.img, options.x+2, options.y+2);
var title = clockInfoItems[options.menuA].name;
var text = info.text.toString().toUpperCase();
var text = info.text.toString().toUpperCase().replace(/[^A-Z0-9]/g, "");
if (title!="Bangle") g.setFontAlign(1,0).drawString(title.toUpperCase(), options.x+options.w-2, options.y+14);
if (g.setFont("7Seg:2").stringWidth(text)+8>options.w) g.setFont("7Seg");
g.setFontAlign(0,0).drawString(text, options.x+options.w/2, options.y+40);
@ -82,4 +82,4 @@ Bangle.drawWidgets();
let clockInfoItems = require("clock_info").load();
let clockInfoMenu = require("clock_info").addInteractive(clockInfoItems, { app:"lcdclock", x:R.x, y:R.y, w:midX-2, h:barY-R.y-2, draw : clockInfoDraw});
let clockInfoMenu2 = require("clock_info").addInteractive(clockInfoItems, { app:"lcdclock", x:midX+2, y:R.y, w:midX-3, h:barY-R.y-2, draw : clockInfoDraw});
}
}