UI tweaks

This commit is contained in:
James Babcock committed 2026-08-22 21:53:54 -07:00
1 parent c199dc2369
commit cc4b69fb80
9 files changed
+19 -12

No files matched your search

-1
View File
@@ -116,7 +116,6 @@ export class AccelerometerDemoLayer implements Layer {
image.drawText(small, 22, 82, "accelerometer at all — experimental.", 120); image.drawText(small, 22, 82, "accelerometer at all — experimental.", 120);
} }
image.drawText(small, 20, height - 16, `${GESTURE_DOUBLE_CLICK} back`, 110);
return image; return image;
} }
+1 -2
View File
@@ -16,7 +16,7 @@ import {
const HEADER_HEIGHT = 30; const HEADER_HEIGHT = 30;
const LIST_X = 20; const LIST_X = 20;
const FOOTER_HEIGHT = 22; const FOOTER_HEIGHT = 0;
function sleep(ms: number): Promise<void> { function sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms)); return new Promise((resolve) => setTimeout(resolve, ms));
@@ -58,7 +58,6 @@ export class BuzzerDemoLayer implements Layer {
image.drawText(font, LIST_X + 110, y + 1, effect.desc, selected ? 180 : 120); image.drawText(font, LIST_X + 110, y + 1, effect.desc, selected ? 180 : 120);
} }
image.drawText(font, 20, height - 16, `${GESTURE_SCROLL} select ${GESTURE_CLICK} play ${GESTURE_DOUBLE_CLICK} back`, 110);
return image; return image;
} }
+3
View File
@@ -25,6 +25,9 @@ const MENU_LAYOUT = {
showBorder: false, showBorder: false,
minHeight: 0, minHeight: 0,
maxHeight: appViewportSize("min").height - 16, maxHeight: appViewportSize("min").height - 16,
// These menus are pages, not popups: "Debug tests" replaces the root menu
// visually instead of letting the taller root show through beneath it.
opaque: true,
}; };
/** A row that opens a nested page: the label plus a right-edge ">". */ /** A row that opens a nested page: the label plus a right-edge ">". */
+2 -2
View File
@@ -78,7 +78,7 @@ export class ResourceUsageLayer implements Layer {
image.drawText( image.drawText(
font, font,
width - 16 - font.measureText(`CPU ${formatPercent(latest.cpuPercent)} threads ${latest.threads}`), width - 16 - font.measureText(`CPU ${formatPercent(latest.cpuPercent)} threads ${latest.threads}`),
37, 47 - font.lineHeight,
`CPU ${formatPercent(latest.cpuPercent)} threads ${latest.threads}`, `CPU ${formatPercent(latest.cpuPercent)} threads ${latest.threads}`,
155, 155,
); );
@@ -105,7 +105,7 @@ export class ResourceUsageLayer implements Layer {
]); ]);
image.drawText(font, 16, height - 16, `-60s`, 80); image.drawText(font, 16, height - 16, `-60s`, 80);
const nowLabel = `now ${GESTURE_DOUBLE_CLICK} back`; const nowLabel = `now`;
image.drawText(font, width - 16 - font.measureText(nowLabel), height - 16, nowLabel, 110); image.drawText(font, width - 16 - font.measureText(nowLabel), height - 16, nowLabel, 110);
return image; return image;
} }
+1 -1
View File
@@ -324,7 +324,7 @@ export const voiceProviderSetting = new ConfigSettingEnum<VoiceProvider>({
const wakeWordActionLabels: Record<WakeWordAction, string> = { const wakeWordActionLabels: Record<WakeWordAction, string> = {
"voice-input": "Voice Input", "voice-input": "Voice Input",
off: "Off", off: "Ignore",
"turn-screen-on": "Turn Screen On", "turn-screen-on": "Turn Screen On",
}; };
+1 -2
View File
@@ -142,7 +142,6 @@ export class FontPickerLayer implements Layer {
const info = `Line height: ${preview.lineHeight}px`; const info = `Line height: ${preview.lineHeight}px`;
image.drawText(font, rowX - 4, previewTop + 8 + preview.lineHeight + 6, info, 110); image.drawText(font, rowX - 4, previewTop + 8 + preview.lineHeight + 6, info, 110);
image.drawText(font, rowX - 4, height - font.lineHeight - 8, `scroll select click change ${GESTURE_DOUBLE_CLICK} cancel`, 90);
return image; return image;
} }
@@ -215,7 +214,7 @@ export class FontPickerLayer implements Layer {
this.draft.kind === "bitmap" this.draft.kind === "bitmap"
? Math.max(0, this.options.bitmapFaces.findIndex((b) => b.face === (this.draft as { face: BitmapFace }).face)) ? Math.max(0, this.options.bitmapFaces.findIndex((b) => b.face === (this.draft as { face: BitmapFace }).face))
: this.options.bitmapFaces.length + this.families.indexOf(this.draft.family); : this.options.bitmapFaces.length + this.families.indexOf(this.draft.family);
openModalMenu(ctx, "Font", items, Math.max(0, currentIndex)); openModalMenu(ctx, "Font Face", items, Math.max(0, currentIndex));
} }
/** Switch families, carrying the weight (nearest available) and size over. */ /** Switch families, carrying the weight (nearest available) and size over. */
+9 -2
View File
@@ -26,6 +26,12 @@ export type MenuLayout = {
minHeight?: number; minHeight?: number;
/** Height cap before the menu starts scrolling. Default: the full screen. */ /** Height cap before the menu starts scrolling. Default: the full screen. */
maxHeight?: number; maxHeight?: number;
/**
* Paint as a standalone page: the layers below stay in the stack for back
* navigation but are not composited underneath. Default: false — the menu
* renders over whatever is below it (modal/window menus).
*/
opaque?: boolean;
}; };
export type MenuItemRenderArgs = { export type MenuItemRenderArgs = {
@@ -192,7 +198,8 @@ export class MenuLayer implements Layer {
paint(ctx: LayerContext, paintBelow: PaintBelow): GrayImage { paint(ctx: LayerContext, paintBelow: PaintBelow): GrayImage {
const font = getDefaultSmallFont(); const font = getDefaultSmallFont();
const rowHeight = listRowHeight(font); const rowHeight = listRowHeight(font);
const image = paintBelow(); const base = ctx.stack.getBaseSize();
const image = this.layout.opaque ? new GrayImage(base.width, base.height, 0) : paintBelow();
const { x, y, width } = this.layout; const { x, y, width } = this.layout;
const chromeTop = (this.title ? menuTitleHeight(font) : 0) + MENU_BODY_PADDING; const chromeTop = (this.title ? menuTitleHeight(font) : 0) + MENU_BODY_PADDING;
const minHeight = this.layout.minHeight ?? DEFAULT_MENU_MIN_HEIGHT; const minHeight = this.layout.minHeight ?? DEFAULT_MENU_MIN_HEIGHT;
@@ -333,7 +340,7 @@ export class TextPageLayer implements Layer {
private readonly body: string, private readonly body: string,
) {} ) {}
paint(ctx: LayerContext): GrayImage { paint(_ctx: LayerContext): GrayImage {
const font = getDefaultSmallFont(); const font = getDefaultSmallFont();
const image = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0); const image = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
image.drawText(font, 18, 14, this.title, 220); image.drawText(font, 18, 14, this.title, 220);
+1 -1
View File
@@ -129,7 +129,7 @@ export class AssistantLayer implements Layer {
image.drawText(font, left + 4, rowY + 2, rows[i]!, selected ? 255 : 200); image.drawText(font, left + 4, rowY + 2, rows[i]!, selected ? 255 : 200);
} }
} else { } else {
image.drawText(font, left, top + DIALOG_H - 14, `${GESTURE_DOUBLE_CLICK} cancel`, 110); image.drawText(font, left, top + DIALOG_H - 14, `${GESTURE_DOUBLE_CLICK} cancel`, 110 - font.lineHeight);
} }
return image; return image;
} }
+1 -1
View File
@@ -268,7 +268,7 @@ export class VoiceInputLayer implements Layer {
image.drawText(font, left + 4, rowY + 2, row.label, row.dim ? 90 : selected ? 255 : 200); image.drawText(font, left + 4, rowY + 2, row.label, row.dim ? 90 : selected ? 255 : 200);
} }
} else { } else {
image.drawText(font, left, top + DIALOG_H - 14, this.hintText(), 110); image.drawText(font, left, top + DIALOG_H - 14, this.hintText(), 110-font.lineHeight);
} }
return image; return image;
} }