# ui_calc.ludic — min(), max() and clamp() (on their own and inside calc()), and top, right, bottom # and left as percentages and calc() of the containing block, for absolute and relative elements. import "ludic.ui" program UiCalc { numbers float const STYLE: string = "" const BODY: string = "
" entry (ui_st: mut UiState) { ui_backend(ui_st, new UiBackend) ui_load_text(ui_st, "" + STYLE + BODY + "", "c.xml") ui_show(ui_st, "c", null, 0.0, 0.0, 400.0, 600.0) let r: UiNode = ui_nodes(ui_st, "c", null) ui_place(ui_st, r, 0.0, 0.0, 400.0, 600.0) let box = r.children[4] let p = box.children[0] let q = box.children[1] let rel = box.children[2] print(`min {int(r.children[0].cw)} max {int(r.children[1].cw)} clamp {int(r.children[2].cw)} {int(r.children[3].ch)} | p {int(p.x - box.x)},{int(p.y - box.y)} q {int(q.x - box.x)},{int(q.y - box.y)} r {int(rel.x - box.x)}`) } }