refactor ui flags

This commit is contained in:
Krzosa Karol
2025-01-16 08:55:00 +01:00
parent 6a1bb5a881
commit 947ac4bdf1
7 changed files with 100 additions and 59 deletions

View File

@@ -48,7 +48,7 @@ fn b32 app_update(app_frame_t *frame) {
defer_block(ui_push_xcontainer(UI_CODE_LOC, ui_em(25), ui_em(30)), ui_pop_parent()) {
ui_box_t *item_box = ui_build_box_from_string(UI_CODE_LOC, flag3(ui_box_flag_scroll, ui_box_flag_draw_rect, ui_box_flag_draw_border), s8_lit("scrolled item_box"));
ui_box_t *item_box = ui_build_box_from_string(UI_CODE_LOC, (ui_box_flags_t){.scroll = true, .draw_rect = true}, s8_lit("scrolled item_box"));
ui_set_semantic_size(item_box, ui_percent(0.97f), ui_percent(1));
item_box->grow_axis = ui_axis2_y;
defer_block(ui_push_parent(item_box), ui_pop_parent()) {
@@ -131,7 +131,6 @@ fn b32 app_update(app_frame_t *frame) {
f32 scroller_size = CLAMP(item_box_size / all_items_size, 0, 1.0f);
f32 scrollable_space = (1 - scroller_size);
f32 scroller_percent = scroller_value * scrollable_space;
f32 inV_scroller_percent = 1.f / scroller_percent;
f32 scroller_second = scrollable_space - scroller_percent;
ui_push_container(UI_CODE_LOC, ui_percent(0.03f), ui_percent(1));