Merge pull request #3592 from Freubert/master

lcdclock/lcdclockplus: fix special characters in clockinfo menus
master
Rob Pilling 2024-09-30 08:55:25 +01:00 committed by GitHub
commit 50e47f27f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 7 additions and 5 deletions

View File

@ -4,3 +4,4 @@
0.04: clock_info is loaded before widgets to match other clocks
0.05: fix alignment of clock items caused by 0.04 (fix #2970)
0.06: Minor code improvements
0.07: fix special characters in clockinfo menus

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});
}
}

View File

@ -1,6 +1,6 @@
{ "id": "lcdclock",
"name": "LCD Clock",
"version": "0.06",
"version": "0.07",
"description": "A Casio-style clock, with ClockInfo areas at the top and bottom. Tap them and swipe up/down to toggle between different information",
"icon": "app.png",
"screenshots": [{"url":"screenshot.png"}],

View File

@ -1,2 +1,3 @@
0.01: New App!
0.02: Minor code improvements
0.03: fix special characters in clockinfo menus

View File

@ -51,7 +51,7 @@ let clockInfoDraw = (itm, info, options) => {
if (info.img) {
g.drawImage(info.img, options.x+1,options.y+2);
}
var text = info.text.toString().toUpperCase();
var text = info.text.toString().toUpperCase().replace(/[^A-Z0-9]/g, "");
if (g.setFont("7Seg:2").stringWidth(text)+24-2>options.w) g.setFont("7Seg");
g.setFontAlign(0,-1).drawString(text, options.x+options.w/2+13, options.y+6);
};

View File

@ -1,6 +1,6 @@
{ "id": "lcdclockplus",
"name": "LCD Clock Plus",
"version": "0.02",
"version": "0.03",
"description": "A Casio-style clock, with four ClockInfo areas at the top and bottom. Tap them and swipe up/down and left/right to toggle between different information.",
"icon": "app.png",
"screenshots": [{"url":"screenshot.png"},{"url":"screenshot2.png"}],