Display lists

This commit is contained in:
James Babcock committed 2026-09-22 00:25:40 -07:00
1 parent a7af84e231
commit 4320021222
44 files changed
+823 -284

No files matched your search

+6 -2
View File
@@ -42,6 +42,7 @@ export type MenuLayout = {
* renders over whatever is below it (modal/window menus).
*/
opaque?: boolean;
squareCorners?: boolean;
};
export type MenuItemRenderArgs = {
@@ -226,6 +227,7 @@ export class MenuLayer implements Layer {
const maxHeight = Math.min(
this.layout.maxHeight ?? image.height - y - DEFAULT_MENU_Y,
image.height - y,
this.layout.squareCorners ? Math.floor(65530 / Math.ceil(width / 2)) : Infinity,
);
const footerHeight = this.layout.footer ? MENU_FOOTER_GAP + lineStep(font) : 0;
const contentHeight = chromeTop + this.items.length * rowHeight + footerHeight + MENU_BODY_PADDING;
@@ -243,9 +245,11 @@ export class MenuLayer implements Layer {
// Fill 1, not 0: identical after 4bpp quantization, but 0 is the
// transparent color key when a menu paints on the shell surface.
image.fillRoundedRect(x, y, width, height, 1);
if (this.layout.squareCorners) image.fillRect(x, y, width, height, 1);
else image.fillRoundedRect(x, y, width, height, 1);
if (this.layout.showBorder !== false) {
image.drawRoundedRect(x, y, width, height, 72);
if (this.layout.squareCorners) image.drawRect(x, y, width, height, 72);
else image.drawRoundedRect(x, y, width, height, 72);
}
if (this.title) {
image.drawText(font, x + 12, y + 8, this.title, 220);