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:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user