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

+1 -1
View File
@@ -162,7 +162,7 @@ export function createInProcessWindow(options: InProcessWindowOptions): InProces
},
});
}
stack.push(new WindowMenuLayer(items));
stack.push(new WindowMenuLayer(options.title, items));
};
const window: ShellWindow = {
+8 -6
View File
@@ -171,13 +171,15 @@ const LONG_PRESS_ESCAPE_MENU_MS = 4000;
class ShellOverlayMenuLayer extends MenuLayer {
constructor(items: MenuItem[], private readonly onClosed: () => void) {
// Aligned to the min-height window band (like the sidebar), wherever the
// vertical position setting currently puts it; past the sidebar strip
// where one reserves width (none in the full-panel mode).
super(null, items, {
x: sidebarWidth() + 8,
// vertical position setting currently puts it; centered over the
// application area, i.e. the part of the screen past the sidebar strip
// (the whole screen in the full-panel mode, where the strip overlays).
const width = 272;
super("System", items, {
x: sidebarWidth() + (((G2_LENS_WIDTH - sidebarWidth() - width) / 2) | 0),
y: minWindowTop() + TOP_BAR_HEIGHT + 8,
width: 272,
minHeight: 0,
width,
minHeight: 150,
});
}
+2 -1
View File
@@ -13,7 +13,7 @@ import { shell, type ShellWindow } from "./shell";
* worker→Java directly.
*/
export type WorkerAppMessage =
| { type: "open-window"; windowId: string; surfaceId: string; viewport: { width: number; height: number } }
| { type: "open-window"; windowId: string; surfaceId: string; title: string; viewport: { width: number; height: number } }
| { type: "close-window"; windowId: string }
| { type: "input"; windowId: string; event: unknown; frameId: number; focused: boolean }
| { type: "text-input"; windowId: string; text: string }
@@ -303,6 +303,7 @@ export class WorkerAppHost {
type: "open-window",
windowId: spec.windowId,
surfaceId,
title: spec.title,
viewport: appViewportSize(heightMode),
});
const window: ShellWindow = {