forked from Blendman974/faceclaw
EvenHub: Fix an issue where indentation was incorrectly dropped in text containers
This caused text to overlap with icons in Iris Pro and Ocuclaw
This commit is contained in:
1 parent
c6fa3647ae
commit
c713815694
9 files changed
+610
-86
No files matched your search
@@ -16,7 +16,7 @@
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { containerFace } from "./fonts";
|
||||
import {
|
||||
type EvenHubContainer,
|
||||
paintOrder,
|
||||
type EvenHubImageContainer,
|
||||
type EvenHubListContainer,
|
||||
type EvenHubPage,
|
||||
@@ -95,22 +95,6 @@ function paintListContainer(image: GrayImage, container: EvenHubListContainer, f
|
||||
paintListItems(image, container, containerFace(container.font), focused);
|
||||
}
|
||||
|
||||
/** Bottom-to-top paint order for a page's containers. */
|
||||
function paintOrder(containers: EvenHubContainer[]): EvenHubContainer[] {
|
||||
const anyZ = containers.some((c) => c.zOrderIndex !== undefined);
|
||||
if (anyZ) {
|
||||
// Explicit z-order: larger zOrderIndex renders closer to the front, i.e.
|
||||
// painted later. (Stock requires all-or-nothing + unique values.)
|
||||
return [...containers].sort((a, b) => (a.zOrderIndex ?? 0) - (b.zOrderIndex ?? 0));
|
||||
}
|
||||
// Default (no z-order): image containers sit below lists and text. Cross-type
|
||||
// order isn't defined by the wire format (separate object arrays), so this is
|
||||
// our choice, matching stock. Order within each group is preserved.
|
||||
const images = containers.filter((c) => c.kind === "image");
|
||||
const rest = containers.filter((c) => c.kind !== "image");
|
||||
return [...images, ...rest];
|
||||
}
|
||||
|
||||
/** Render a page into a fresh app-viewport image (positioned by the shell). */
|
||||
export function compositePage(page: EvenHubPage | null, size: { width: number; height: number }, focused: boolean): GrayImage {
|
||||
const image = new GrayImage(size.width, size.height, 0);
|
||||
|
||||
Reference in new issue
Block a user