wip(0.S3): packages and examples migrated in one run - ludic migrate state packages <every example program> packages/ludic.lab/example/plate.ludic
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d490d4f9f1
commit
3eda72e8c2
172 changed files with 3094 additions and 2966 deletions
|
|
@ -1,19 +1,19 @@
|
|||
# layout.ludic - flex layout on the CSS box model, top-down: a box is told how wide it may be,
|
||||
# measures its content at that width (so a wrapping row knows how tall it is), then places each
|
||||
# child. A size is the border box: padding and border inside it, margin outside it.
|
||||
function ly_measure(n: UiNode, avail: float, size: float, fg: int) -> void {
|
||||
function ly_measure(ui_st: mut UiState, n: UiNode, avail: float, size: float, fg: int) -> void {
|
||||
n.rsize = size * zm_own(n)
|
||||
if n.size > 0.0 { n.rsize = n.size }
|
||||
n.rfg = fg
|
||||
n.rfg_a = ly_fg_a
|
||||
n.rfg_a = ui_st.ly_fg_a
|
||||
if n.fg != UI_INHERIT {
|
||||
n.rfg = n.fg
|
||||
n.rfg_a = n.fg_a
|
||||
}
|
||||
ly_fg_a = n.rfg_a
|
||||
ui_st.ly_fg_a = n.rfg_a
|
||||
n.mw = ly_hin(n)
|
||||
n.mh = ly_vin(n)
|
||||
if n.kind == UI_TEXT { ly_measure_text(n, avail) }
|
||||
if n.kind == UI_TEXT { ly_measure_text(ui_st, n, avail) }
|
||||
if n.kind == UI_NATIVE and n.native.measure != null {
|
||||
let base_w = n.mw
|
||||
let base_h = n.mh
|
||||
|
|
@ -33,7 +33,7 @@ function ly_measure(n: UiNode, avail: float, size: float, fg: int) -> void {
|
|||
var inner = avail - n.ml - n.mr
|
||||
if fixed_w >= 0.0 { inner = fixed_w }
|
||||
inner = ly_clamp(inner, n.min_w, n.max_w) - ly_hin(n)
|
||||
if n.dir == UI_ROW and n.wrap { ly_measure_wrap(n, inner) } else { ly_measure_box(n, inner) }
|
||||
if n.dir == UI_ROW and n.wrap { ly_measure_wrap(ui_st, n, inner) } else { ly_measure_box(ui_st, n, inner) }
|
||||
}
|
||||
n.content_h = n.mh
|
||||
if fixed_w >= 0.0 { n.mw = fixed_w }
|
||||
|
|
@ -43,7 +43,6 @@ function ly_measure(n: UiNode, avail: float, size: float, fg: int) -> void {
|
|||
n.mh = ly_clamp(n.mh, n.min_h, n.max_h)
|
||||
ly_min_note(n)
|
||||
}
|
||||
var ly_fg_a: float = 1.0
|
||||
function ly_hin(n: UiNode) -> float { return n.pl + n.pr + n.bl + n.br }
|
||||
function ly_vin(n: UiNode) -> float { return n.pt + n.pb + n.bt + n.bb }
|
||||
function ly_clamp(v: float, lo: float, hi: float) -> float {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue