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

+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;
/**