issues
search
nicopap
/
cuicui_layout
The dumbest and simplest layouting algorithm for bevy
40
stars
2
forks
source link
Parameter substitution in template extras are broken
#99
Open
nicopap
opened
1 year ago
nicopap
commented
1 year ago
Variable scoping is still flaky.
Reproducible example chirp file
In the following code, `width` in `green_row` should be replaced by ```rust fn button(width_rule, button_text) { Button(focus row rules(width_rule, 30px)) { ButtonText(text(button_text)) } } fn long_button(text) { button!(80%, text) } fn green_row(name, width, neg_width) { Entity(row rules(99%, 35px)) { long_button!(Go to right menu)(rules(width, 30px) named(name)) Entity(row menu(name) bg(#FFFFFF20) rules(neg_width, 100%) main_margin(3.)) { Entity(width(0%)) square_button!(1) square_button!(2) square_button!(3) Entity(width(0%)) } } } RootRoot(column screen_root) { green_row!(green_1, 50%, 49%) } ``` I get this error: ``` Error: × Rule format was not recognized: 'width', rules end with '%', '*' or 'px'. Examples: │ '53%', '0.35*' and '1024px' ╭─[ultimate_menu.chirp:35:1] 35 │ fn green_row(name, width, neg_width) { 36 │ Entity(row rules(99%, 35px)) { 37 │ long_button!(Go to right menu)(rules(width, 30px) named(name)) · ─────────── 38 │ Entity(row menu(name) bg(#FFFFFF20) rules(neg_width, 100%) main_margin(3.)) { 39 │ Entity(width(0%)) ╰──── help: The error comes from the ParseDsl implementation. ```
Variable scoping is still flaky.
Reproducible example chirp file
In the following code, `width` in `green_row` should be replaced by ```rust fn button(width_rule, button_text) { Button(focus row rules(width_rule, 30px)) { ButtonText(text(button_text)) } } fn long_button(text) { button!(80%, text) } fn green_row(name, width, neg_width) { Entity(row rules(99%, 35px)) { long_button!(Go to right menu)(rules(width, 30px) named(name)) Entity(row menu(name) bg(#FFFFFF20) rules(neg_width, 100%) main_margin(3.)) { Entity(width(0%)) square_button!(1) square_button!(2) square_button!(3) Entity(width(0%)) } } } RootRoot(column screen_root) { green_row!(green_1, 50%, 49%) } ``` I get this error: ``` Error: × Rule format was not recognized: 'width', rules end with '%', '*' or 'px'. Examples: │ '53%', '0.35*' and '1024px' ╭─[ultimate_menu.chirp:35:1] 35 │ fn green_row(name, width, neg_width) { 36 │ Entity(row rules(99%, 35px)) { 37 │ long_button!(Go to right menu)(rules(width, 30px) named(name)) · ─────────── 38 │ Entity(row menu(name) bg(#FFFFFF20) rules(neg_width, 100%) main_margin(3.)) { 39 │ Entity(width(0%)) ╰──── help: The error comes from the ParseDsl implementation. ```