Timers: "to 9:30a" under a countdown-to-time, smaller status lines, titles that fit

A ProPresenter count_down_to_time timer's detail line reads "to 9:30a"
(or "to 21:30" on a 24-hour clock) instead of a sentence. The status and
detail lines under the digits are drawn at 0.8 of the title's size, and
fit() budgets them at that share. A title that would be cut off shrinks
to fit its card (measured off-screen, down to 8 px) instead of ending in
an ellipsis; a changed label re-fits.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Waters Church
2026-09-15 09:05:56 -04:00
co-authored by Claude Fable 5.1
parent 0acaf47ac7
commit 1db6c2c89f
3 changed files with 32 additions and 6 deletions
+3 -3
View File
@@ -171,14 +171,14 @@ function fmtMs(ms) {
return h ? `${h}:${pad(m)}:${pad(sec)}` : `${m}:${pad(sec)}`;
}
/** ProPresenter's count_down_to_time target: seconds since midnight + am/pm/24h. */
/** ProPresenter's count_down_to_time target, short: "9:30a", "12:05p", or "21:30" for a 24-hour clock. */
function timeOfDayText(seconds, period) {
const s = Number(seconds);
if (!Number.isFinite(s)) return '';
const h = Math.floor(s / 3600) % 24;
const m = Math.floor((s % 3600) / 60);
const p = String(period || '').toLowerCase();
if (p === 'am' || p === 'pm') return `${h % 12 || 12}:${String(m).padStart(2, '0')} ${p}`;
if (p === 'am' || p === 'pm') return `${h % 12 || 12}:${String(m).padStart(2, '0')}${p[0]}`;
return `${String(h).padStart(2, '0')}:${String(m).padStart(2, '0')}`;
}
@@ -278,7 +278,7 @@ function createProPresenterSource({ config, log }) {
}
if (entry.count_down_to_time) {
const at = timeOfDayText(entry.count_down_to_time.time_of_day, entry.count_down_to_time.period);
return { type: 'countdown_to_time', targetMs: null, detail: at ? `Counts down to ${at}` : 'Counts down to a time of day' };
return { type: 'countdown_to_time', targetMs: null, detail: at ? `to ${at}` : 'to a time of day' };
}
if (entry.elapsed) {
const end = Number(entry.elapsed.end_time);