mirror of
https://git.undefined-dev.fr/Blendman974/faceclaw.git
synced 2026-11-19 21:03:09 +00:00
Fix missing submenu indicators and change their appearance. Clean up styling in the Terminal app and move Settings to the top-level menu. Remove right padding from the bottom bar.
15 lines
809 B
TypeScript
15 lines
809 B
TypeScript
import { wrapText, type WrapFont } from '../../graphics/textwrap';
|
|
|
|
/** Left edge of the hub's title line (and of a wrapped status block under it). */
|
|
export const HUB_TITLE_X = 12;
|
|
|
|
/** Keep short status on the title row; give long errors their full width. */
|
|
export function layoutHubHeader(font: WrapFont, title: string, status: string, width: number, step: number) {
|
|
const inlineX = HUB_TITLE_X + font.measureText(title) + 16;
|
|
const inline = !/[\r\n]/.test(status) && font.measureText(status) <= Math.max(0, width - inlineX - 12);
|
|
const lines = inline ? [status] : wrapText(font, status, Math.max(1, width - HUB_TITLE_X - 12));
|
|
const x = inline ? inlineX : HUB_TITLE_X;
|
|
const y = inline ? 10 : 10 + step;
|
|
return { x, y, lines, listTop: inline ? 16 + step : 16 + step * (1 + lines.length) };
|
|
}
|