Fix "array status" and several other pages in the "Microphone setup" app not rendering when not full-screen

This commit is contained in:
James Babcock committed 2026-10-14 01:15:51 -07:00
1 parent 54f4852564
commit 5436744549
2 files changed
+21 -8

No files matched your search

+10 -6
View File
@@ -1,4 +1,4 @@
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage, type UiFont } from "../graphics/image";
import { G2_LENS_HEIGHT, GrayImage, type UiFont } from "../graphics/image";
import { wrapText } from "../graphics/textwrap";
import { getDefaultSmallFont } from "../graphics/ui-fonts";
import { getStringSetting } from "../native/settings-store";
@@ -397,16 +397,20 @@ export class TextPageLayer implements Layer {
private readonly body: string,
) {}
paint(_ctx: LayerContext): GrayImage {
paint(ctx: LayerContext): GrayImage {
const font = getDefaultSmallFont();
const image = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
// Size to the stack, not the lens: in an app window the stack is the
// window's viewport, and the compositor rejects a frame larger than its
// surface (leaving the previous frame on screen).
const { width, height } = ctx.stack.getBaseSize();
const image = new GrayImage(width, height, 0);
image.drawText(font, 18, 14, this.title, 220);
image.drawRect(12, 12, G2_LENS_WIDTH - 24, G2_LENS_HEIGHT - 24, 52);
image.drawRect(12, 12, width - 24, height - 24, 52);
const wrapped = wrapText(font, this.body, G2_LENS_WIDTH - 60);
const wrapped = wrapText(font, this.body, width - 60);
const step = lineStep(font);
const bodyTop = 28 + font.lineHeight;
const footerY = G2_LENS_HEIGHT - 48;
const footerY = height - 48;
const maxBodyLines = Math.max(0, Math.floor((footerY - bodyTop - 8) / step));
for (let index = 0; index < Math.min(wrapped.length, maxBodyLines); index++) {
image.drawText(font, 24, bodyTop + index * step, wrapped[index]!, 190);