forked from Blendman974/faceclaw
feat: isolate notification popups and scroll selected menu labels
This commit is contained in:
1 parent
b4a2b2931b
commit
22df4d76d9
14 files changed
+577
-26
No files matched your search
@@ -1,11 +1,12 @@
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { DrawOp } from "../../graphics/display-list";
|
||||
import { flattenPlanes } from "../../graphics/plane";
|
||||
import { InputEvent } from "../gestures";
|
||||
import { Layer, LayerActions, LayerContext, LayerStack, PaintBelow } from "../layers";
|
||||
import { appViewportRect, appViewportSize, SHELL_OPAQUE_BLACK } from "./geometry";
|
||||
|
||||
// The modal covers most of the min-height app viewport, leaving a little of
|
||||
// the foreground app visible around the edges. Both its size and position are
|
||||
// The modal box covers most of the min-height app viewport. Retained vector
|
||||
// clears hide the app outside its opaque rect. Size and position are
|
||||
// computed per paint: the display-mode setting changes the viewport size at
|
||||
// runtime, and the vertical position setting moves the band.
|
||||
const MODAL_MARGIN = 14;
|
||||
@@ -33,9 +34,11 @@ export function modalRect(): { x: number; y: number; width: number; height: numb
|
||||
|
||||
/**
|
||||
* A shell overlay hosting an inner layer stack in a bordered box over the
|
||||
* app viewport (used for new-notification popups). The inner stack paints at
|
||||
* the modal's interior size; its pixels blit onto an opaque black backdrop,
|
||||
* so inner value-0 pixels read as black, not transparent.
|
||||
* app viewport (used for new-notification popups). It replaces the shell's
|
||||
* lower layers. Only the box is opaque, so its cropped image fits the 64 KiB
|
||||
* resource limit; a resource-free retained list clears the outside margins
|
||||
* over separate app surfaces. The inner stack paints at the modal's interior
|
||||
* size; inner value-0 pixels read as black, not transparent.
|
||||
*/
|
||||
export class ShellModalLayer implements Layer {
|
||||
private readonly stack: LayerStack;
|
||||
@@ -57,8 +60,14 @@ export class ShellModalLayer implements Layer {
|
||||
this.hooks.removed?.();
|
||||
}
|
||||
|
||||
paint(_ctx: LayerContext, paintBelow: PaintBelow): GrayImage {
|
||||
const image = paintBelow();
|
||||
paint(ctx: LayerContext, _paintBelow: PaintBelow): GrayImage {
|
||||
// Do not call paintBelow: retained chrome/menu animations must not remain
|
||||
// beneath the notification. Leave the outer margins transparent so the
|
||||
// scene encoder crops to the resource-sized modal, not the whole display.
|
||||
// Native dim=0 still preserves a 1/0 halftone; clipped CLEAR calls below
|
||||
// instead produce literal black without changing shared dimming semantics.
|
||||
const { width, height } = ctx.stack.getBaseSize();
|
||||
const image = new GrayImage(width, height);
|
||||
// Track a display-mode switch while the modal is up, so the inner stack
|
||||
// paints at the same size the box below is drawn with.
|
||||
const interior = modalInterior();
|
||||
@@ -78,6 +87,19 @@ export class ShellModalLayer implements Layer {
|
||||
image.drawRect(rect.x, rect.y, rect.width, rect.height, 110);
|
||||
image.bitBlt(inner, innerX, innerY, { transparentZero: true });
|
||||
top.image.copyPresentationsInto(image, innerX + top.x, innerY + top.y);
|
||||
// ShellScene replays retained calls after the opaque box. Clear only the
|
||||
// complement of that box, keeping the inner menu's presentation order.
|
||||
// These are vector clips, not tiled image resources; no full-screen image
|
||||
// is uploaded. Clips move with the scene's stereo depth just like the box.
|
||||
const margins = [
|
||||
{ x: 0, y: 0, width, height: rect.y },
|
||||
{ x: 0, y: rect.y + rect.height, width, height: height - rect.y - rect.height },
|
||||
{ x: 0, y: rect.y, width: rect.x, height: rect.height },
|
||||
{ x: rect.x + rect.width, y: rect.y, width: width - rect.x - rect.width, height: rect.height },
|
||||
];
|
||||
image.drawDisplayList({ resources: [], calls: margins
|
||||
.filter(clip => clip.width > 0 && clip.height > 0)
|
||||
.map(clip => ({ op: DrawOp.CLEAR, color: 0, clip })) }, 0, 0, width, height);
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user