feat(ui): add cardSide grid helper
Square-card grids reflow on rotation, and the arithmetic is the same in every app that draws one.
This commit is contained in:
@@ -187,4 +187,11 @@ assert(ui.getTheme() == "mono" and #invalidated == before + 1)
|
||||
assert(cleared == ui.theme.background)
|
||||
|
||||
screen:draw()
|
||||
|
||||
-- 320x480 portrait: three columns, and the reserve comes off the height budget.
|
||||
local side, columns = ui.cardSide(5, 12, 8)
|
||||
assert(columns == 3 and side == 93, "width is the binding constraint in portrait")
|
||||
-- Five cards are two rows, so a reserve that eats the height budget shrinks the card.
|
||||
assert(select(1, ui.cardSide(5, 12, 8, 300)) == 74, "height binds once the reserve is large")
|
||||
|
||||
print("ok")
|
||||
|
||||
Reference in New Issue
Block a user