ui, fix scrolled elements stealing hot

This commit is contained in:
Krzosa Karol
2025-01-22 08:59:20 +01:00
parent 02638f80f0
commit 98f5116ee6
4 changed files with 25 additions and 14 deletions

View File

@@ -27,7 +27,7 @@ typedef double f64;
#define fn
#define gb
#define locl
#define locl static
#if PLATFORM_WASM
#define gb_wasm_export __attribute__((visibility("default")))

View File

@@ -57,7 +57,7 @@ enum lex_kind_t {
X(lex_kind_arrow , "'->' arrow" , "->" )\
X(lex_kind_question , "'?' question mark" , "?" )\
X(lex_kind_tag , "'@' tag sign" , "@" )\
X(lex_kind_escape , "'\' escape" , "\\" )\
X(lex_kind_escape , "'\\' escape" , "\\" )\
X(lex_kind_preproc_null , "preproc_null" , "---" )\
X(lex_kind_preproc_define , "preproc_define" , "---" )\
X(lex_kind_preproc_ifdef , "preproc_ifdef" , "---" )\

View File

@@ -295,8 +295,8 @@ fn r2f32_t window_rect_from_frame(app_frame_t *frame) {
}
fn void ui__draw_box(app_frame_t *frame, ui_box_t *box) {
box->final_rect = box->full_rect;
r2f32_t rect = box->final_rect;
r2f32_t rect = box->full_rect;
box->final_rect = r2f32_intersect(box->full_rect, ui->clip_rect);
v4f32_t rect_color = primary_color_global;
if (!v4f32_is_null(box->background_color)) rect_color = box->background_color;
@@ -587,12 +587,13 @@ fn void ui_demo_update(app_frame_t *frame) {
ui_box_t *item_box = ui_box0((ui_box_flags_t){.draw_rect = true, .clip_rect = true});
ui_set_rect(item_box, r2f32_cut_left(&ui->top->rect, ui_max));
static f32 scroller_value;
ui_set_text_align(ui_text_align_left)
ui_set_top(item_box) {
for (i32 i = 0; i < lengthof(tweak_table); i += 1) {
mt_tweak_t *tweak = tweak_table + i;
if (s8_starts_with(tweak->name, s8_lit("_"), false)) continue;
if (s8_starts_with(tweak->name, s8_lit("_"), false)) {
continue;
}
if (tweak->type->kind == type_kind_b32) {
b32 *n = (b32 *)tweak->ptr;
@@ -613,6 +614,7 @@ fn void ui_demo_update(app_frame_t *frame) {
ui_serial_type(&ui_test_event, type(app_event_t));
}
locl f32 scroller_value;
// @todo: fix scroller to match mouse
defer_block(ui_push_top(scroller_box), ui_pop_top()) {
f32 item_count = (f32)item_box->node_count;