feat(ui): popovers, tooltips, progress; the render3d backend installs itself; duplicate names caught first
- `popover`: a top layer that keeps the pointer and the keyboard, closed by a press outside or Esc. - `title` tooltips after half a second's rest, styled by .ui-tooltip. - `<progress>` and `<meter>`. - Atlases take rows and number cells, and importing ludic.ui/render3d.ludic is enough to draw with render3d. - The compiler reports two declarations of one name before it type-checks, so a package global clashing with a program's reads as that, not as 29 type errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
1dad96102a
commit
0a7525b125
24 changed files with 243 additions and 21 deletions
|
|
@ -21,7 +21,21 @@ function ct_part(n: UiNode, cls: string, text: string) -> UiNode {
|
|||
}
|
||||
return p
|
||||
}
|
||||
# <progress value max> and <meter value min max>: a track with a fill as far as the value
|
||||
function ct_build_bar(n: UiNode) -> void {
|
||||
n.dir = UI_ROW
|
||||
let lo = Value.as_float(ui_attr(n, "min"))
|
||||
var hi = Value.as_float(ui_attr(n, "max"))
|
||||
if hi <= lo { hi = lo + 1.0 }
|
||||
let fill = ct_part(n, "ui-fill", "")
|
||||
fill.w_pct = Math.clamp((Value.as_float(ui_attr(n, "value")) - lo) / (hi - lo), 0.0, 1.0) * 100.0
|
||||
push(n.children, fill)
|
||||
}
|
||||
function ct_build(n: UiNode) -> void {
|
||||
if n.tag == "progress" or n.tag == "meter" {
|
||||
ct_build_bar(n)
|
||||
return
|
||||
}
|
||||
n.dir = UI_ROW
|
||||
n.focusable = true
|
||||
let t = ui_attr_text(n, "type")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue