widmsggrid: fix drawing outside of widget field

... when the circle containing single digit numbers was drawn.
pull/3300/head
thyttan 2024-03-27 00:06:30 +01:00
parent c615653d83
commit eb73a84086
3 changed files with 3 additions and 2 deletions

View File

@ -3,3 +3,4 @@
0.03: Use new message library 0.03: Use new message library
0.04: Remove library stub 0.04: Remove library stub
0.05: Don't turn on LCD 0.05: Don't turn on LCD
0.06: Don't draw outside of widget field

View File

@ -1,7 +1,7 @@
{ {
"id": "widmsggrid", "id": "widmsggrid",
"name": "Messages Grid Widget", "name": "Messages Grid Widget",
"version": "0.05", "version": "0.06",
"description": "Widget that displays notification icons in a grid", "description": "Widget that displays notification icons in a grid",
"icon": "widget.png", "icon": "widget.png",
"type": "widget", "type": "widget",

View File

@ -52,7 +52,7 @@
if (w.total > 1) { if (w.total > 1) {
// show total number of messages in bottom-right corner // show total number of messages in bottom-right corner
g.reset(); g.reset();
if (w.total < 10) g.fillCircle(w.x + w.width - 5, w.y + 20, 4); // single digits get a round background, double digits fill their rectangle if (w.total < 10) g.fillCircle(w.x + w.width - 5, w.y + 19, 4); // single digits get a round background, double digits fill their rectangle
g.setColor(g.theme.bg).setBgColor(g.theme.fg) g.setColor(g.theme.bg).setBgColor(g.theme.fg)
.setFont('6x8').setFontAlign(1, 1) .setFont('6x8').setFontAlign(1, 1)
.drawString(w.total, w.x + w.width - 1, w.y + 24, w.total > 9); .drawString(w.total, w.x + w.width - 1, w.y + 24, w.total > 9);