- <input type="number" min max step>: typed digits replace its value (a minus when min allows one, a point when step has a fraction), Enter or leaving the field commits them held between min and max, the left and right arrows step it. - <input type="key">: Enter or a click starts it listening and the next key is its value, Tab, the arrows and Enter included; Esc stops it listening, Backspace clears it, `shown` names the value, and ui_capturing() tells the host to leave its keys alone (through the frame that ended it). - note="..." under any control's label (.ui-labels > .ui-label + .ui-note); a range's (or number's) value with decimals, format="percent" and a unit. - A popover with `anchor="id"` (the nearest element of that id) or a bare `anchor` (the element before it) sits beside it by `placement` (right, left, bottom, top), its margin the gap, opens to the other side where it would leave the screen, and is kept on it. - A tooltip's title splits into lines at a newline or a written \n. - text-shadow, inherited, drawn sharp under the text. - ui_opacity(): the group opacity a native's draw is at. - border-image is drawn as painted with no background colour, tinted by one, and not at all when that colour is transparent (it drew a white nine-slice). - A picture file is drawn untinted, as a browser draws one; an atlas cell (prefix:name) still takes the color around it, and an <img> with its own color is tinted by it. - The render3d backend loads a picture again when its file changes or appears (a failed load was kept for ever), and at once after ui_image_reload(path); takes a path with a drive letter (C:/...) as a path rather than an atlas; and slices a nine-slice by its texture's own width and height. - ui_inputs.ludic and ui_look.ludic; LANGUAGE.md and the changeset say all of it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.5 KiB
Text
36 lines
1.5 KiB
Text
# dump.ludic - a laid-out tree, for a test or a look
|
|
# every node and where it went, one line each - for a test, or a look at a layout
|
|
export function ui_dump(n: UiNode, depth: int) -> string {
|
|
var pad = ""
|
|
for d in 0 .. depth { pad = pad + " " }
|
|
var out = `{pad}{dp_name(n)} {int(n.x)},{int(n.y)} {int(n.cw)}x{int(n.ch)}{dp_style(n)} {n.text}\n`
|
|
if n.children != null {
|
|
for i in 0 .. len(n.children) { out = out + ui_dump(n.children[i], depth + 1) }
|
|
}
|
|
return out
|
|
}
|
|
# tag#id.class.class, or the kind of a node the template did not name
|
|
function dp_name(n: UiNode) -> string {
|
|
var s = n.tag
|
|
if s == "" { s = `({n.kind})` }
|
|
if n.id != "" { s = s + "#" + n.id }
|
|
if n.classes != null {
|
|
for i in 0 .. len(n.classes) { s = s + "." + n.classes[i] }
|
|
}
|
|
return s
|
|
}
|
|
# the computed styles that differ from an element's defaults
|
|
function dp_style(n: UiNode) -> string {
|
|
var s = ""
|
|
if n.size > 0.0 { s = s + ` font {int(n.size)}` }
|
|
if n.fg >= 0 { s = s + ` color {ui_hex(n.fg)}` }
|
|
if n.bg >= 0 and n.bg_a > 0.0 { s = s + ` bg {ui_hex(n.bg)}` }
|
|
if n.alpha < 1.0 { s = s + ` opacity {n.alpha}` }
|
|
if n.pt + n.pr + n.pb + n.pl > 0.0 { s = s + ` pad {int(n.pt)} {int(n.pr)} {int(n.pb)} {int(n.pl)}` }
|
|
if n.mt + n.mr + n.mb + n.ml > 0.0 { s = s + ` margin {int(n.mt)} {int(n.mr)} {int(n.mb)} {int(n.ml)}` }
|
|
if n.grow > 0.0 { s = s + ` grow {n.grow}` }
|
|
if n.pos > 0 { s = s + ` pos {n.pos} z {n.z}` }
|
|
if not n.enabled { s = s + " disabled" }
|
|
if s == "" { return "" }
|
|
return " [" + s[1..len(s)] + "]"
|
|
}
|