Merge commit 'e476a9d' into lang/foundations
This commit is contained in:
commit
06ecc5cd8e
12 changed files with 129 additions and 2 deletions
|
|
@ -26,7 +26,7 @@ function act_parse(src: string, err: []string) -> UiAct {
|
|||
push(a.exprs, px_cond(r))
|
||||
} else if act_keyword(r, "emit") {
|
||||
push(a.kinds, A_EMIT)
|
||||
push(a.names, rd_name(r))
|
||||
push(a.names, tpl_event(rd_name(r))) # `emit click` reaches on-click, which is kept as press
|
||||
push(a.exprs, null)
|
||||
} else {
|
||||
push(a.kinds, A_CALL)
|
||||
|
|
|
|||
|
|
@ -65,3 +65,20 @@ function ct_is_int(s: string, i: int) -> bool {
|
|||
}
|
||||
return false
|
||||
}
|
||||
|
||||
# a press let go over a control: on a select's < it steps back, anywhere else on it forward (the <
|
||||
# stepped forward too, so a cycler's left arrow did the right one's job)
|
||||
function ct_activate_at(ui_st: mut UiState, n: UiNode, x: float, y: float) -> void {
|
||||
if ct_type(n) == "select" and ct_over_part(n, "ui-prev", x, y) {
|
||||
ct_step(ui_st, n, -1)
|
||||
return
|
||||
}
|
||||
ct_activate(ui_st, n)
|
||||
}
|
||||
function ct_over_part(n: UiNode, cls: string, x: float, y: float) -> bool {
|
||||
for i in 0 .. len(n.children) {
|
||||
let c = n.children[i]
|
||||
if sel_has(c.classes, cls) and x >= c.x and y >= c.y and x < c.x + c.cw and y < c.y + c.ch { return true }
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ function fr_pointer(ui_st: mut UiState, root: UiNode) -> void {
|
|||
if not i.down and ui_st.in_was_down {
|
||||
let was = fr_node(root, ui_st.fr_press_key)
|
||||
if was != null { ui_fire(ui_st, was, "up", ui_st.fc_none) }
|
||||
if hit != null and hit.key == ui_st.fr_press_key and hit.enabled { ct_activate(ui_st, hit) }
|
||||
if hit != null and hit.key == ui_st.fr_press_key and hit.enabled { ct_activate_at(ui_st, hit, i.x, i.y) }
|
||||
ui_st.fr_press_key = ""
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue