Fix a crash in the onboarding flow

This commit is contained in:
James Babcock committed 2026-10-17 16:29:02 -07:00
1 parent de653f0fbb
commit ba125ad413
2 files changed
+5 -3

No files matched your search

+2 -1
View File
@@ -48,7 +48,8 @@ export class DisplayModePage implements OnboardingPage {
"Swipe to choose how much of the display windows use; it changes as you go. Tap to continue.",
) + CONTENT_GAP;
const body = onboardingFont("body");
const columnWidth = 20 + Math.max(...this.menu.items.map((value) => body.measureText(displayLayoutSetting.displayValue(value))));
// TTF widths are fractional; the menu's row images need whole pixels.
const columnWidth = Math.ceil(20 + Math.max(...this.menu.items.map((value) => body.measureText(displayLayoutSetting.displayValue(value)))));
const menuBox = { x: PAGE_X - 10, y: top, width: columnWidth, height: image.height - top - BOTTOM_MARGIN };
this.menu.paint(image, menuBox, focused);
const layout = this.menu.selectedItem;
+3 -2
View File
@@ -99,8 +99,9 @@ export class TextSizePage implements OnboardingPage {
) + CONTENT_GAP;
const height = image.height - top - BOTTOM_MARGIN;
const body = onboardingFont("body");
const columnWidth = 20 + Math.max(...this.face.sizes.map((size) => body.measureText(sizeLabel(size)))) +
NOTE_GAP + onboardingFont("detail").measureText(RECOMMENDED_NOTE);
// TTF widths are fractional; the menu's row images need whole pixels.
const columnWidth = Math.ceil(20 + Math.max(...this.face.sizes.map((size) => body.measureText(sizeLabel(size)))) +
NOTE_GAP + onboardingFont("detail").measureText(RECOMMENDED_NOTE));
const menuBox = { x: PAGE_X - 10, y: top, width: columnWidth, height };
this.sizeMenu.paint(image, menuBox, focused);
const previewX = menuBox.x + menuBox.width + COLUMN_GAP;