feat: isolate notification popups and scroll selected menu labels

This commit is contained in:
MasterControl committed 2026-11-10 17:31:13 +00:00
1 parent b4a2b2931b
commit 22df4d76d9
14 files changed
+577 -26

No files matched your search

+6 -5
View File
@@ -7,7 +7,7 @@ import { clamp } from "../util/numeric-util";
import { normalizeAnimationSpeed } from "./animation-speed";
import { Layer, LayerContext, PaintBelow } from "./layers";
import { MENU_ANIMATION_KEY, setMenuAnimationReader } from "./menu-animation-pref";
import { Menu, MENU_HIGHLIGHT_FILL, MENU_HIGHLIGHT_STROKE } from "./menu-core";
import { Menu, drawMenuLabel, MENU_HIGHLIGHT_FILL, MENU_HIGHLIGHT_STROKE } from "./menu-core";
import { GESTURE_DOUBLE_CLICK, InputEvent } from "./gestures";
import { LIST_ROW_TEXT_INSET, centeredTextY, lineStep, listRowHeight, menuTitleHeight } from "./metrics";
@@ -179,7 +179,7 @@ export function submenuItem(
render: ({ image, x, y, width, height, selected, disabled, text }) => {
const font = getDefaultSmallFont();
const value = disabled ? 70 : selected ? 255 : 200;
image.drawText(font, x, y + LIST_ROW_TEXT_INSET, text, value);
drawMenuLabel(image, font, x, y + LIST_ROW_TEXT_INSET, width - font.measureText("▶") - 12, text, value);
drawSubmenuIndicator(image, font, x, y, width, height, value);
},
};
@@ -200,7 +200,7 @@ export function drawToggleMenuItem(
const switchX = x + width - switchWidth - 2;
// Center the switch on the row's line box (legacy y+1 at the 12px default).
const switchY = y + Math.max(1, Math.round((listRowHeight(font) - 2 - switchHeight) / 2));
image.drawText(font, x, y + LIST_ROW_TEXT_INSET, label, 200);
drawMenuLabel(image, font, x, y + LIST_ROW_TEXT_INSET, switchX - x - 8, label, 200);
const offFill = selected ? 1 : 18;
image.fillRoundedRect(switchX, switchY, switchWidth, switchHeight, enabled ? 70 : offFill, 8);
image.drawRoundedRect(switchX, switchY, switchWidth, switchHeight, enabled ? 130 : 55, 8);
@@ -218,8 +218,8 @@ export function drawRightValueMenuItem(
label: string,
value: string,
): void {
image.drawText(font, x, y + LIST_ROW_TEXT_INSET, label, 200);
const valueX = x + width - font.measureText(value) - 2;
drawMenuLabel(image, font, x, y + LIST_ROW_TEXT_INSET, valueX - x - 8, label, 200);
image.drawText(font, valueX, y + LIST_ROW_TEXT_INSET, value, 220);
}
@@ -268,7 +268,8 @@ export class MenuLayer implements Layer {
ctx: this.paintCtx!,
});
} else {
image.drawText(font, x + MENU_ROW_TEXT_INSET, y + LIST_ROW_TEXT_INSET, item.label,
drawMenuLabel(image, font, x + MENU_ROW_TEXT_INSET, y + LIST_ROW_TEXT_INSET,
width - 2 * MENU_ROW_TEXT_INSET, item.label,
disabled ? 70 : selected ? 255 : 200);
}
},