feat(ui): size a grid to the app's box, not the panel

Chrome takes the top of the panel before an app builds anything, and layout
has not run yet when it does, so ui.frame() reports what the mount left it.
This commit is contained in:
2026-08-04 21:15:21 -04:00
parent 25b576a3d9
commit 4b89b27947
3 changed files with 26 additions and 4 deletions
+6
View File
@@ -251,6 +251,12 @@ assert(cleared == ui.theme.background)
ui.draw()
-- The inset chrome took comes off the height budget before anything else.
ui.setInset(44)
assert(select(2, ui.frame()) == 436, "the frame is the panel minus the chrome")
assert(select(1, ui.cardSide(5, 12, 8)) == 132, "a grid fits the app's box, not the panel")
ui.setInset(0)
-- 320x480 portrait: two columns, and the reserve comes off the height budget.
local side, columns = ui.cardSide(5, 12, 8)
assert(columns == 2 and side == 144, "width is the binding constraint in portrait")