Context menus are centered and include window title

This commit is contained in:
James Babcock committed 2026-09-01 00:58:28 -07:00
1 parent 5158bc86ff
commit b1493a353d
14 files changed
+55 -18

No files matched your search

+3
View File
@@ -136,6 +136,7 @@ type GamePhase = "playing" | "paused" | "game-over";
type BlocksWindow = {
windowId: string;
surfaceId: string;
title: string;
viewportWidth: number;
viewportHeight: number;
foreground: boolean;
@@ -181,6 +182,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
const window: BlocksWindow = {
windowId: message.windowId,
surfaceId: message.surfaceId,
title: message.title,
viewportWidth: message.viewport.width,
viewportHeight: message.viewport.height,
foreground: false,
@@ -303,6 +305,7 @@ function openWindowMenu(window: BlocksWindow): void {
function windowMenu(window: BlocksWindow): WindowMenu {
if (!window.menu) {
window.menu = new WindowMenu({
title: () => window.title,
size: { width: window.viewportWidth, height: window.viewportHeight },
paintBase: () => paintContent(window),
isFocused: () => window.focused,