From 319d22fab675bd9ca0c81ab26c58b2aeb6d1299f Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Fri, 3 Nov 2023 08:42:14 +0000 Subject: [PATCH] widclk 0.08: Ensure we clear the whole rect so we don't end up leaving old text when time changes (fix #3073) --- apps/widclk/ChangeLog | 1 + apps/widclk/metadata.json | 2 +- apps/widclk/widget.js | 6 +++--- apps/widclkbttm/ChangeLog | 2 +- apps/widclkbttm/metadata.json | 2 +- apps/widclkbttm/widclkbttm.wid.js | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/widclk/ChangeLog b/apps/widclk/ChangeLog index 1a89e2780..bbf9f2762 100644 --- a/apps/widclk/ChangeLog +++ b/apps/widclk/ChangeLog @@ -4,3 +4,4 @@ 0.05: Don't show clock widget if already showing clock app 0.06: Use 7 segment font, update *on* the minute, use less memory 0.07: allow turning on/off when quick-switching apps +0.08: Ensure we clear the whole rect so we don't end up leaving old text when time changes (fix #3073) \ No newline at end of file diff --git a/apps/widclk/metadata.json b/apps/widclk/metadata.json index e4d7d76d1..b0e345ad9 100644 --- a/apps/widclk/metadata.json +++ b/apps/widclk/metadata.json @@ -1,7 +1,7 @@ { "id": "widclk", "name": "Digital clock widget", - "version": "0.07", + "version": "0.08", "description": "A simple digital clock widget that appears when not showing a fullscreen clock", "icon": "widget.png", "type": "widget", diff --git a/apps/widclk/widget.js b/apps/widclk/widget.js index a31bd4772..af35ae459 100644 --- a/apps/widclk/widget.js +++ b/apps/widclk/widget.js @@ -7,13 +7,13 @@ WIDGETS["wdclk"]={area:"tl",width:Bangle.CLOCK?0:52/* g.stringWidth("00:00") */, return setTimeout(Bangle.drawWidgets,1); // widget changed size - redraw } if (!this.width) return; // if not visible, return -g.reset().setFontCustom(atob("AAAAAAAAAAIAAAQCAQAAAd0BgMBdwAAAAAAAdwAB0RiMRcAAAERiMRdwAcAQCAQdwAcERiMRBwAd0RiMRBwAAEAgEAdwAd0RiMRdwAcERiMRdwAFAAd0QiEQdwAdwRCIRBwAd0BgMBAAABwRCIRdwAd0RiMRAAAd0QiEQAAAAAAAAAA="), 32, atob("BgAAAAAAAAAAAAAAAAYCAAYGBgYGBgYGBgYCAAAAAAAABgYGBgYG"), 512+9); +g.reset().setFontCustom(atob("AAAAAAAAAAIAAAQCAQAAAd0BgMBdwAAAAAAAdwAB0RiMRcAAAERiMRdwAcAQCAQdwAcERiMRBwAd0RiMRBwAAEAgEAdwAd0RiMRdwAcERiMRdwAFAAd0QiEQdwAdwRCIRBwAd0BgMBAAABwRCIRdwAd0RiMRAAAd0QiEQAAAAAAAAAA="), 32, atob("BgAAAAAAAAAAAAAAAAYCAAYGBgYGBgYGBgYCAAAAAAAABgYGBgYG"), 512+9).setFontAlign(0,0); var time = require("locale").time(new Date(),1); - g.drawString(time, this.x, this.y+3, true); // 5 * 6*2 = 60 + g.clearRect(this.x, this.y, this.x+this.width-1, this.y+23).drawString(time, this.x+this.width/2, this.y+12); // 5 * 6*2 = 60 // queue draw in one minute if (this.drawTimeout) clearTimeout(this.drawTimeout); this.drawTimeout = setTimeout(()=>{ this.drawTimeout = undefined; this.draw(); }, 60000 - (Date.now() % 60000)); -}}; +}}; \ No newline at end of file diff --git a/apps/widclkbttm/ChangeLog b/apps/widclkbttm/ChangeLog index 373337378..29958b249 100644 --- a/apps/widclkbttm/ChangeLog +++ b/apps/widclkbttm/ChangeLog @@ -3,4 +3,4 @@ 0.03: based in widclk v0.05 compatible at same time, bottom area and color 0.04: refactored to use less memory, and allow turning on/off when quick-switching apps 0.05: Remove cyan color, use theme foreground instead - +0.06: Ensure we clear the whole rect so we don't end up leaving old text when time changes diff --git a/apps/widclkbttm/metadata.json b/apps/widclkbttm/metadata.json index 4b14ef9c6..5721f0114 100644 --- a/apps/widclkbttm/metadata.json +++ b/apps/widclkbttm/metadata.json @@ -2,7 +2,7 @@ "id": "widclkbttm", "name": "Digital clock (Bottom) widget", "shortName": "Digital clock Bottom Widget", - "version": "0.05", + "version": "0.06", "description": "Displays time HH:mm in the bottom of the screen (may not be compatible with some apps)", "icon": "widclkbttm.png", "type": "widget", diff --git a/apps/widclkbttm/widclkbttm.wid.js b/apps/widclkbttm/widclkbttm.wid.js index 50142a5b9..55c841500 100644 --- a/apps/widclkbttm/widclkbttm.wid.js +++ b/apps/widclkbttm/widclkbttm.wid.js @@ -4,7 +4,7 @@ WIDGETS["wdclkbttm"]={area:"br",width:Bangle.CLOCK?0:60,draw:function() { return setTimeout(Bangle.drawWidgets,1); // widget changed size - redraw } if (!this.width) return; // if not visible, return - g.reset().setFont("6x8", 2).setFontAlign(-1, 0); + g.reset().setFont("6x8", 2).setFontAlign(-1, 0).clearRect(this.x, this.y, this.x+this.width-1, this.y+23); var time = require("locale").time(new Date(),1); g.drawString(time, this.x, this.y+11, true); // 5 * 6*2 = 60 // queue draw in one minute