From 391df1c82eac4ede475b0118ee44fcc9ca9c308b Mon Sep 17 00:00:00 2001 From: Travis Evans Date: Wed, 30 Apr 2025 19:10:07 -0500 Subject: [PATCH] =?UTF-8?q?Allow=20horizontal=20font=20size=20changes=20fo?= =?UTF-8?q?r=20=E2=80=9CCurrent=20auto=E2=80=9D=20mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/tevtimer/app.js | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/apps/tevtimer/app.js b/apps/tevtimer/app.js index 1f38d805b..ec20ef1b8 100644 --- a/apps/tevtimer/app.js +++ b/apps/tevtimer/app.js @@ -338,21 +338,22 @@ class TimerView { if (!item || item == 'timer') { - this._update_fonts(); - let update_interval = Infinity; for (var id of ROW_IDS) { const elem = this.layout[id]; const running = this.timer.is_running(); + let mode = tt.SETTINGS.format[id]; + // Special handling for “auto” modes + if (mode == 'current auto') { + mode = Bangle.isLocked() ? 'current hh:mm' : 'current hh:mm:ss'; + } + if (mode == 'start hh:mm:ss') { elem.label = tt.format_duration(this.timer.to_msec(this.timer.origin), true); - } else if ( - mode == 'current hh:mm:ss' - || (mode == 'current auto' && !Bangle.isLocked()) - ) { + } else if (mode == 'current hh:mm:ss') { elem.label = tt.format_duration(this.timer.to_msec(), true); if (running) { update_interval = Math.min( @@ -371,10 +372,7 @@ class TimerView { } else if (mode == 'start hh:mm') { elem.label = tt.format_duration(this.timer.to_msec(this.timer.origin), false); - } else if ( - mode == 'current hh:mm' - || (mode == 'current auto' && Bangle.isLocked()) - ) { + } else if (mode == 'current hh:mm') { elem.label = tt.format_duration(this.timer.to_msec(), false); if (running) { // Update every minute for current HM when running @@ -395,6 +393,7 @@ class TimerView { elem.label = this.timer.display_name(); } + elem.font = row_font(id, mode); this.layout.clear(elem); this.layout.render(elem); } @@ -426,15 +425,6 @@ class TimerView { } } - _update_fonts() { - for (var id of ROW_IDS) { - const elem = this.layout[id]; - elem.font = row_font(id, tt.SETTINGS.format[id]); - this.layout.clear(elem); - this.layout.render(elem); - } - } - start_stop_timer() { // Start or pause the timer