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

+3 -3
View File
@@ -12,7 +12,7 @@ const DIALOG_X = 40;
const DIALOG_W = G2_LENS_WIDTH - 80;
// The dialog fits inside the min-height window band (like the other shell
// overlays), wherever the vertical position setting puts it.
const DIALOG_MARGIN_Y = 24;
const DIALOG_MARGIN_Y = 28;
const DIALOG_H = MIN_WINDOW_HEIGHT - 2 * DIALOG_MARGIN_Y;
const TEXT_MAX_WIDTH = DIALOG_W - 32;
const MENU_ROWS = 2;
@@ -95,8 +95,8 @@ export class AssistantLayer implements Layer {
// Solid dialog box (fill 1, matching the voice dialog: opaque after 4bpp
// quantization, but not the color-key transparent 0).
image.fillRoundedRect(DIALOG_X, top, DIALOG_W, DIALOG_H, 1, 10);
image.drawRoundedRect(DIALOG_X, top, DIALOG_W, DIALOG_H, 90, 10);
image.fillRect(DIALOG_X, top, DIALOG_W, DIALOG_H, 1);
image.drawRect(DIALOG_X, top, DIALOG_W, DIALOG_H, 90);
const left = DIALOG_X + 16;
image.drawText(font, left, top + 12, this.phase === "thinking" ? "Assistant ●" : "Assistant", 220);
+2 -2
View File
@@ -25,8 +25,8 @@ export class BrightnessPickerLayer implements Layer {
const height = BAR_HEIGHT + 3 * font.lineHeight + 56;
const left = viewport.x + Math.round((viewport.width - DIALOG_WIDTH) / 2);
const top = viewport.y + Math.round((viewport.height - height) / 2);
image.fillRoundedRect(left, top, DIALOG_WIDTH, height, SHELL_OPAQUE_BLACK, 8);
image.drawRoundedRect(left, top, DIALOG_WIDTH, height, 110, 8);
image.fillRect(left, top, DIALOG_WIDTH, height, SHELL_OPAQUE_BLACK);
image.drawRect(left, top, DIALOG_WIDTH, height, 110);
const centeredText = (text: string, y: number, value: number) => {
image.drawText(font, left + Math.round((DIALOG_WIDTH - font.measureText(text)) / 2), y, text, value);
+30 -6
View File
@@ -1,3 +1,5 @@
import { shellCrop } from "../../graphics/shell-scene";
import type { Plane } from "../../graphics/plane";
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "../../graphics/image";
import { getDefaultMediumFont, getDefaultSmallFont } from "../../graphics/ui-fonts";
import { truncateText } from "../../graphics/textwrap";
@@ -18,7 +20,7 @@ import {
} from "../dashboard-settings";
import { formatClockDate, formatClockTime } from "../clock-format";
import { getFont } from "../../graphics/bdffont";
import { Layer } from "../layers";
import { Layer, LayerStack } from "../layers";
import { scrollToKeepSelectionVisible } from "../menu";
import { lineStep } from "../metrics";
import {
@@ -216,6 +218,21 @@ export class ShellChromeLayer implements Layer {
return image;
}
paintParts(): Plane[] {
const state = this.getState(), parts: Plane[] = [];
if (sidebarStripVisible(state.focus, state.foregroundAppId)) {
const canvas = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
this.drawSidebar(canvas, state);
parts.push(shellCrop(canvas, 0, minWindowTop(state.foregroundAppId), SIDEBAR_WIDTH, MIN_WINDOW_HEIGHT, 1));
}
const canvas = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
this.drawTopBar(canvas, state);
const left = sidebarStripVisible(state.focus, state.foregroundAppId) ? SIDEBAR_WIDTH : 0;
parts.push(shellCrop(canvas, left, windowTop(state.foregroundHeightMode, state.foregroundAppId), G2_LENS_WIDTH-left, TOP_BAR_HEIGHT, 2));
drawAmbientCards(canvas, parts);
return parts;
}
handleInput(): void {
// Shell input is handled by the shell state machine before it reaches the
// layer stack; the chrome itself never consumes events.
@@ -500,7 +517,8 @@ const AMBIENT_MAX_LINES_PER_CARD = 3;
* bottom of the window band and newer ones stack above it. Cards that would
* cross into the top bar are dropped rather than clipped.
*/
function drawAmbientCards(image: GrayImage): void {
const ambientKeys = new Map<string, number>();
function drawAmbientCards(image: GrayImage, parts?: Plane[]): void {
const cards = activeAmbientCards();
if (!cards.length) return;
const font = getDefaultSmallFont();
@@ -514,10 +532,11 @@ function drawAmbientCards(image: GrayImage): void {
const height = 2 * AMBIENT_CARD_PADDING_Y + lines.length * lineStep(font);
const y = bottom - height;
if (y < bandTop + TOP_BAR_HEIGHT) break;
image.fillRoundedRect(x, y, AMBIENT_CARD_WIDTH, height, SHELL_OPAQUE_BLACK, 6);
image.drawRoundedRect(x, y, AMBIENT_CARD_WIDTH, height, 90, 6);
const target = parts ? new GrayImage(image.width, image.height, 0) : image;
target.fillRect(x, y, AMBIENT_CARD_WIDTH, height, SHELL_OPAQUE_BLACK);
target.drawRect(x, y, AMBIENT_CARD_WIDTH, height, 90);
for (let index = 0; index < lines.length; index++) {
image.drawText(
target.drawText(
font,
x + AMBIENT_CARD_PADDING_X,
y + AMBIENT_CARD_PADDING_Y + index * lineStep(font),
@@ -525,6 +544,11 @@ function drawAmbientCards(image: GrayImage): void {
index === 0 ? 220 : 160,
);
}
if (parts) {
let key = ambientKeys.get(card.id);
if (key === undefined) { key = LayerStack.allocateShellKey(); ambientKeys.set(card.id, key); }
parts.push(shellCrop(target, x, y, AMBIENT_CARD_WIDTH, height, key));
}
bottom = y - AMBIENT_CARD_GAP;
}
}
@@ -557,7 +581,7 @@ function attentionDot(value: number): GrayImage {
const TAB_RADIUS = 6;
// How far the diversion pokes past the separator into the main area.
const TAB_EXTEND = 1;
const TAB_EXTEND = 0;
const TAB_STROKE = 150;
/**
+3 -3
View File
@@ -16,7 +16,7 @@ const DIALOG_X = 40;
const DIALOG_W = G2_LENS_WIDTH - 80;
// The dialog fits inside the min-height window band (like the other shell
// overlays), wherever the vertical position setting puts it.
const DIALOG_MARGIN_Y = 24;
const DIALOG_MARGIN_Y = 28;
const DIALOG_H = MIN_WINDOW_HEIGHT - 2 * DIALOG_MARGIN_Y;
const TEXT_MAX_WIDTH = DIALOG_W - 32;
@@ -51,8 +51,8 @@ export function paintInputDialog(image: GrayImage, content: InputDialogContent):
// Solid dialog box over the underlying UI. Fill 1, not 0: identical after
// 4bpp quantization, but 0 is transparent on the color-key shell surface.
image.fillRoundedRect(DIALOG_X, top, DIALOG_W, DIALOG_H, 1, 10);
image.drawRoundedRect(DIALOG_X, top, DIALOG_W, DIALOG_H, 90, 10);
image.fillRect(DIALOG_X, top, DIALOG_W, DIALOG_H, 1);
image.drawRect(DIALOG_X, top, DIALOG_W, DIALOG_H, 90);
const left = DIALOG_X + 16;
image.drawText(font, left, top + 12, content.title, 220);
+4 -4
View File
@@ -16,7 +16,7 @@ function modalInterior(): { width: number; height: number } {
const viewport = appViewportSize("min");
return {
width: viewport.width - 2 * MODAL_MARGIN - 2 * MODAL_PADDING,
height: viewport.height - 2 * MODAL_MARGIN - 2 * MODAL_PADDING,
height: Math.min(viewport.height - 2 * MODAL_MARGIN, Math.floor(65530 / Math.ceil((viewport.width - 2 * MODAL_MARGIN) / 2))) - 2 * MODAL_PADDING,
};
}
@@ -27,7 +27,7 @@ export function modalRect(): { x: number; y: number; width: number; height: numb
x: viewport.x + MODAL_MARGIN,
y: viewport.y + MODAL_MARGIN,
width: viewport.width - 2 * MODAL_MARGIN,
height: viewport.height - 2 * MODAL_MARGIN,
height: Math.min(viewport.height - 2 * MODAL_MARGIN, Math.floor(65530 / Math.ceil((viewport.width - 2 * MODAL_MARGIN) / 2))),
};
}
@@ -54,8 +54,8 @@ export class ShellModalLayer implements Layer {
// below transplants the finished modal content into this layer's plane.
const inner = flattenPlanes(this.stack.paint(), interior);
const rect = modalRect();
image.fillRoundedRect(rect.x, rect.y, rect.width, rect.height, SHELL_OPAQUE_BLACK, 8);
image.drawRoundedRect(rect.x, rect.y, rect.width, rect.height, 110, 8);
image.fillRect(rect.x, rect.y, rect.width, rect.height, SHELL_OPAQUE_BLACK);
image.drawRect(rect.x, rect.y, rect.width, rect.height, 110);
image.bitBlt(inner, rect.x + MODAL_PADDING, rect.y + MODAL_PADDING, { transparentZero: true });
return image;
}
+6 -2
View File
@@ -1,3 +1,4 @@
import { encodeShellScene } from "../../graphics/shell-scene";
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "../../graphics/image";
import { singlePlane, type Plane } from "../../graphics/plane";
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
@@ -229,6 +230,7 @@ class ShellOverlayMenuLayer extends MenuLayer {
y: minWindowTop() + TOP_BAR_HEIGHT + 8,
width,
minHeight: 150,
squareCorners: true,
footer,
dimUnderneath: CONTEXT_MENU_DIM,
});
@@ -266,8 +268,8 @@ class ShellAlertLayer implements Layer {
const font = getDefaultSmallFont();
// Positioned within the min-height window band, like the other shell overlays.
const alertY = minWindowTop() + ALERT_Y;
image.fillRoundedRect(ALERT_X, alertY, ALERT_W, ALERT_H, 1, 10);
image.drawRoundedRect(ALERT_X, alertY, ALERT_W, ALERT_H, 90, 10);
image.fillRect(ALERT_X, alertY, ALERT_W, ALERT_H, 1);
image.drawRect(ALERT_X, alertY, ALERT_W, ALERT_H, 90);
image.drawText(font, ALERT_X + 16, alertY + 12, "Assistant", 200);
image.drawTextWrapped({
font,
@@ -690,6 +692,8 @@ class Shell {
}
/** Paint the shell surface: transparent chrome, or all-transparent when asleep. */
paintScene(): Uint8Array { return encodeShellScene(this.screenOn ? this.stack.paintUndimmed() : []); }
paintSurface(): Plane[] {
if (!this.screenOn) {
return singlePlane(new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0));
+4 -3
View File
@@ -19,7 +19,7 @@ import { lineStep } from "../metrics";
const DIALOG_WIDTH = 420;
// Shell overlays align to the min-height window band; the detail box fills
// the band below the top bar with an 8px margin on each side.
const DETAIL_HEIGHT = MIN_WINDOW_HEIGHT - TOP_BAR_HEIGHT - 16;
const DETAIL_HEIGHT = 208;
/** Dialog left edge: past the sidebar strip where one reserves width. */
function dialogX(): number {
@@ -42,6 +42,7 @@ export class ToolDebugMenuLayer extends MenuLayer {
x: dialogX(),
y: dialogY(),
width: DIALOG_WIDTH,
squareCorners: true,
minHeight: 0,
});
}
@@ -89,8 +90,8 @@ class ToolDetailLayer implements Layer {
const left = dialogX();
const width = detailWidth();
const top = dialogY();
image.fillRoundedRect(left, top, width, DETAIL_HEIGHT, 1, 10);
image.drawRoundedRect(left, top, width, DETAIL_HEIGHT, 72, 10);
image.fillRect(left, top, width, DETAIL_HEIGHT, 1);
image.drawRect(left, top, width, DETAIL_HEIGHT, 72);
const textX = left + DETAIL_PADDING;
const textWidth = width - 2 * DETAIL_PADDING - 8;