ludic.ui: nothing a frame on the pack screen - a key's down/up carry one kept null, scroll asks filtered in place, a shadow's colour joined through the memo, numbers to 65536 made once each
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8dfcccad41
commit
0f534731a6
5 changed files with 24 additions and 14 deletions
|
|
@ -55,7 +55,7 @@ function el_shadow(ui_st: mut UiState, n: UiNode, s: string) -> void {
|
||||||
if nums == 0 { n.sh_x = el_unit(ui_st, p) }
|
if nums == 0 { n.sh_x = el_unit(ui_st, p) }
|
||||||
if nums == 1 { n.sh_y = el_unit(ui_st, p) }
|
if nums == 1 { n.sh_y = el_unit(ui_st, p) }
|
||||||
nums += 1
|
nums += 1
|
||||||
} else if col == "" { col = p } else { col = col + " " + p }
|
} else if col == "" { col = p } else { col = mm_join(ui_st, col, " ", p) }
|
||||||
}
|
}
|
||||||
if col == "" { col = "rgba(0,0,0,0.5)" }
|
if col == "" { col = "rgba(0,0,0,0.5)" }
|
||||||
n.sh_c = ui_color(ui_st, col)
|
n.sh_c = ui_color(ui_st, col)
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ export state UiState {
|
||||||
uv_false: Val = null
|
uv_false: Val = null
|
||||||
mm: UiMemo = null # memo.ludic: splits, gradients and keys by their text
|
mm: UiMemo = null # memo.ludic: splits, gradients and keys by their text
|
||||||
mm_ints: []string = null
|
mm_ints: []string = null
|
||||||
|
fc_none: Val = Value.null() # focus.ludic: the value a key's down and up carry, made once
|
||||||
mm_ivals: []Val = null
|
mm_ivals: []Val = null
|
||||||
ev_depth: int = 0 # eval.ludic: a call's arguments, in lists kept one a depth
|
ev_depth: int = 0 # eval.ludic: a call's arguments, in lists kept one a depth
|
||||||
ev_args: []Val = new []Val
|
ev_args: []Val = new []Val
|
||||||
|
|
|
||||||
|
|
@ -49,12 +49,12 @@ function fc_keys(ui_st: mut UiState, root: UiNode) -> void {
|
||||||
function fc_hold(ui_st: mut UiState, root: UiNode, n: UiNode) -> void {
|
function fc_hold(ui_st: mut UiState, root: UiNode, n: UiNode) -> void {
|
||||||
if ui_st.fr_key_press != "" and (ui_st.in_act_up or n.key != ui_st.fr_key_press) {
|
if ui_st.fr_key_press != "" and (ui_st.in_act_up or n.key != ui_st.fr_key_press) {
|
||||||
let was = fr_node(root, ui_st.fr_key_press)
|
let was = fr_node(root, ui_st.fr_key_press)
|
||||||
if was != null { ui_fire(ui_st, was, "up", Value.null()) }
|
if was != null { ui_fire(ui_st, was, "up", ui_st.fc_none) }
|
||||||
ui_st.fr_key_press = ""
|
ui_st.fr_key_press = ""
|
||||||
}
|
}
|
||||||
if ui_st.in_act_down and n.enabled {
|
if ui_st.in_act_down and n.enabled {
|
||||||
ui_st.fr_key_press = n.key
|
ui_st.fr_key_press = n.key
|
||||||
ui_fire(ui_st, n, "down", Value.null())
|
ui_fire(ui_st, n, "down", ui_st.fc_none)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function ui_focus(ui_st: mut UiState, key: string) -> void {
|
export function ui_focus(ui_st: mut UiState, key: string) -> void {
|
||||||
|
|
|
||||||
|
|
@ -36,14 +36,19 @@ function mm_join(ui_st: mut UiState, a: string, sep: string, b: string) -> strin
|
||||||
m.slots[at] = len(m.keys)
|
m.slots[at] = len(m.keys)
|
||||||
return k
|
return k
|
||||||
}
|
}
|
||||||
# a small whole number's text, made once (a key's index, a loop's count)
|
# a whole number's text, made once (a key's index, a count, money): 0..1023 at the start, the rest up
|
||||||
|
# to MM_INT_MOST the first time each is shown; only past that is one made per call
|
||||||
|
const MM_INT_MOST: int = 65536
|
||||||
function mm_int(ui_st: mut UiState, i: int) -> string {
|
function mm_int(ui_st: mut UiState, i: int) -> string {
|
||||||
if i < 0 or i >= 1024 { return string(i) }
|
if i < 0 or i >= MM_INT_MOST { return string(i) }
|
||||||
if ui_st.mm_ints == null {
|
if ui_st.mm_ints == null {
|
||||||
ui_st.mm_ints = new []string
|
ui_st.mm_ints = new []string
|
||||||
for k in 0 .. 1024 { push(ui_st.mm_ints, string(k)) }
|
for k in 0 .. 1024 { push(ui_st.mm_ints, string(k)) }
|
||||||
}
|
}
|
||||||
return ui_st.mm_ints[i]
|
let l = ui_st.mm_ints
|
||||||
|
while len(l) <= i { push(l, "") }
|
||||||
|
if i >= 1024 and len(l[i]) == 0 { l[i] = string(i) }
|
||||||
|
return l[i]
|
||||||
}
|
}
|
||||||
# a small whole number as a Value, made once and shared: read it, never change it (a loop's index)
|
# a small whole number as a Value, made once and shared: read it, never change it (a loop's index)
|
||||||
function mm_ival(ui_st: mut UiState, i: int) -> Val {
|
function mm_ival(ui_st: mut UiState, i: int) -> Val {
|
||||||
|
|
|
||||||
|
|
@ -10,16 +10,20 @@ export function ui_scroll_set(ui_st: mut UiState, key: string, px: float) -> voi
|
||||||
function sc_held(ui_st: mut UiState, n: UiNode, off: float, live: bool) -> float {
|
function sc_held(ui_st: mut UiState, n: UiNode, off: float, live: bool) -> float {
|
||||||
var at = off
|
var at = off
|
||||||
if live {
|
if live {
|
||||||
let keys = new []string
|
let keys = ui_st.sc_want_keys # the asks for this box taken out in place, the others kept
|
||||||
let pxs = new []float
|
let pxs = ui_st.sc_want_px
|
||||||
for i in 0 .. len(ui_st.sc_want_keys) {
|
var kept = 0
|
||||||
if ui_st.sc_want_keys[i] == n.key or (n.id != "" and ui_st.sc_want_keys[i] == n.id) { at = ui_px(ui_st, ui_st.sc_want_px[i]) } else {
|
for i in 0 .. len(keys) {
|
||||||
push(keys, ui_st.sc_want_keys[i])
|
if keys[i] == n.key or (n.id != "" and keys[i] == n.id) { at = ui_px(ui_st, pxs[i]) } else {
|
||||||
push(pxs, ui_st.sc_want_px[i])
|
keys[kept] = keys[i]
|
||||||
|
pxs[kept] = pxs[i]
|
||||||
|
kept += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ui_st.sc_want_keys = keys
|
while len(keys) > kept {
|
||||||
ui_st.sc_want_px = pxs
|
List.pop(keys)
|
||||||
|
List.pop(pxs)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let v = ui_attr(n, "scroll-top")
|
let v = ui_attr(n, "scroll-top")
|
||||||
if Value.kind(v) != 0 { at = ui_px(ui_st, el_numv(ui_st, v)) }
|
if Value.kind(v) != 0 { at = ui_px(ui_st, el_numv(ui_st, v)) }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue