ludic.ui: string matching compares in place - at_alias, lk_in, colours and every s[a..b] == p made a string per position tried, per rule, per element, per frame (a benchmark page: ~3 MB -> 256 KB a frame)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8808dda605
commit
83200a453b
17 changed files with 84 additions and 50 deletions
|
|
@ -7,7 +7,7 @@ export property UiGradient {
|
|||
alphas: []float = null
|
||||
at: []float = null # each stop's place, 0 to 1
|
||||
}
|
||||
function gr_is(s: string) -> bool { return len(s) > 16 and s[0..16] == "linear-gradient(" }
|
||||
function gr_is(s: string) -> bool { return len(s) > 16 and sat(s, 0, "linear-gradient(") }
|
||||
function gr_parse(ui_st: mut UiState, s0: string) -> UiGradient {
|
||||
let s = tpl_words(s0)
|
||||
let parts = el_commas(s[16..len(s) - 1])
|
||||
|
|
@ -36,7 +36,7 @@ function gr_parse(ui_st: mut UiState, s0: string) -> UiGradient {
|
|||
return g
|
||||
}
|
||||
function gr_dir(g: UiGradient, w: string) -> bool {
|
||||
if w == "to bottom" { g.dir = 0 } else if w == "to top" { g.dir = 1 } else if w == "to right" { g.dir = 2 } else if w == "to left" { g.dir = 3 } else if len(w) > 3 and w[len(w) - 3..len(w)] == "deg" {
|
||||
if w == "to bottom" { g.dir = 0 } else if w == "to top" { g.dir = 1 } else if w == "to right" { g.dir = 2 } else if w == "to left" { g.dir = 3 } else if len(w) > 3 and sat(w, len(w) - 3, "deg") {
|
||||
let d = int(Math.round(el_num(w) / 90.0)) % 4
|
||||
g.dir = 1
|
||||
if d == 1 or d == -3 { g.dir = 2 }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue