Merge commit '9b3d3e3' into lang/foundations

This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 13:27:18 +03:00
commit f38581754a
5 changed files with 67 additions and 2 deletions

View file

@ -7,6 +7,7 @@
function ct_part(ui_st: mut UiState, n: UiNode, cls: string, text: string) -> UiNode {
let p = nd_take(ui_st)
p.key = mm_join(ui_st, n.key, "/", cls)
p.hovered = fr_was_hovered(ui_st, p.key) # a part answers :hover as an element does (a select's < and >)
p.tag = "span"
p.env = n.env
p.sheet = n.sheet

View file

@ -42,8 +42,9 @@ function fr_active(ui_st: UiState, n: UiNode) -> bool {
return ui_st.fr_key_press != "" and lc_mine(ui_st.fr_key_press, n.key)
}
function fr_under(n: UiNode, px: float, py: float, keys: []string) -> void {
if px < n.x or py < n.y or px >= n.x + n.cw or py >= n.y + n.ch { return }
if n.key != "" { ui_kept(keys, n.key) }
let out = px < n.x or py < n.y or px >= n.x + n.cw or py >= n.y + n.ch
if out and not fr_empty(n) { return }
if not out and n.key != "" { ui_kept(keys, n.key) }
for i in 0 .. len(n.children) { fr_under(n.children[i], px, py, keys) }
}
# the control (or pressable element) the pointer is on: out from the topmost element under it

View file

@ -36,10 +36,17 @@ function fr_pick(n: UiNode, px: float, py: float, kind: int) -> UiNode {
while k >= 0 {
let c = n.children[k]
if c.pos == 0 and not c.popover and fr_in(c, px, py) { return fr_pick_in(n, c, px, py, kind) }
if c.pos == 0 and not c.popover and fr_empty(c) {
let r = fr_pick(c, px, py, kind)
if r != null and r != c { return r }
}
k -= 1
}
return fr_wants(n, kind)
}
# a box with no size of its own - a component's root <div> round a positioned screen - holds no point
# and clips nothing: what it holds is looked through it (a screen in one was pressed and hovered never)
function fr_empty(n: UiNode) -> bool { return n.children != null and (n.cw <= 0.0 or n.ch <= 0.0) }
function fr_pick_in(n: UiNode, c: UiNode, px: float, py: float, kind: int) -> UiNode {
let r = fr_pick(c, px, py, kind)
if r != null { return r }