[widalarmeta] move "Only on clock" check to top of draw

master
Logan B 2025-07-30 20:39:56 -05:00
parent d31c6ca12a
commit 7fc876237d
No known key found for this signature in database
1 changed files with 43 additions and 40 deletions

View File

@ -39,6 +39,13 @@
} // getNextAlarm } // getNextAlarm
function draw(_w, fromInterval) { function draw(_w, fromInterval) {
// If only show on clock and not on clock
if (config.whenToShow === 1 && !Bangle.CLOCK) {
this.nextAlarm = undefined; // make sure to reload later
return;
}
if (this.nextAlarm === undefined) { if (this.nextAlarm === undefined) {
let alarm = getNextAlarm(); let alarm = getNextAlarm();
if (alarm === undefined) { if (alarm === undefined) {
@ -56,9 +63,6 @@
let calcWidth = 0; let calcWidth = 0;
let drawSeconds = false; let drawSeconds = false;
// If always showing, or the clock is visible
if (config.whenToShow === 1 && !Bangle.CLOCK)
return;
// Determine text and width // Determine text and width
if (next > 0 && next <= config.maxhours*60*60*1000) { if (next > 0 && next <= config.maxhours*60*60*1000) {
const hours = Math.floor((next-1) / 3600000).toString(); const hours = Math.floor((next-1) / 3600000).toString();
@ -100,7 +104,6 @@
this.bellVisible = true; this.bellVisible = true;
} }
} }
}
if (this.width !== calcWidth) { if (this.width !== calcWidth) {
// width changed, re-layout // width changed, re-layout