Add text size buttons to the console's top bar (v3.2.1)

AI Assisted
This commit is contained in:
jparkerweb committed 2026-11-29 20:48:03 -08:00
1 parent 8277c8b548
commit 634e4df10e
25 files changed
+188 -40

No files matched your search

+14 -1
View File
@@ -5,7 +5,7 @@ import { adoptLooks, applyLooks, loadLooks, looks, renderSwatches, saveLooks, sy
import { dropHeldSound, previewSound, releaseHeldSound, sound, soundOn } from "../sound.js";
import { hushTones, tone, unlockTones } from "../tones.js";
import { hushMusic } from "../music.js";
import { SOUND_EVENTS, soundFileKey, soundKey } from "../palette.js";
import { DEFAULT_TEXT_SIZE, SOUND_EVENTS, TEXT_SIZES, soundFileKey, soundKey } from "../palette.js";
import { ROLES, ROLE_NOT_SET, ROLE_NOT_SET_LABEL, needsRoleNudge, normalizeRole } from "../starters.js";
import { isDashboard } from "../selectors.js";
import { el } from "../render.js";
@@ -63,6 +63,19 @@ export function wireLooks() {
hooks.markSaved(fieldsetOf(radio), saveLooks());
});
}
// The top bar's text size: one step each way, the label back to 100%.
const stepText = (by) => {
const at = TEXT_SIZES.indexOf(looks.textSize) + by;
if (at < 0 || at >= TEXT_SIZES.length) return;
looks.textSize = TEXT_SIZES[at];
saveLooks();
};
$("btn-text-smaller").addEventListener("click", () => stepText(-1));
$("btn-text-larger").addEventListener("click", () => stepText(1));
$("btn-text-size").addEventListener("click", () => {
looks.textSize = DEFAULT_TEXT_SIZE;
saveLooks();
});
for (const radio of document.querySelectorAll('input[name="looks-width"]')) {
radio.addEventListener("change", () => {
looks.width = radio.value;