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 fn
#define gb #define gb
#define locl #define locl static
#if PLATFORM_WASM #if PLATFORM_WASM
#define gb_wasm_export __attribute__((visibility("default"))) #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_arrow , "'->' arrow" , "->" )\
X(lex_kind_question , "'?' question mark" , "?" )\ X(lex_kind_question , "'?' question mark" , "?" )\
X(lex_kind_tag , "'@' tag sign" , "@" )\ 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_null , "preproc_null" , "---" )\
X(lex_kind_preproc_define , "preproc_define" , "---" )\ X(lex_kind_preproc_define , "preproc_define" , "---" )\
X(lex_kind_preproc_ifdef , "preproc_ifdef" , "---" )\ 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) { fn void ui__draw_box(app_frame_t *frame, ui_box_t *box) {
box->final_rect = box->full_rect; r2f32_t rect = box->full_rect;
r2f32_t rect = box->final_rect; box->final_rect = r2f32_intersect(box->full_rect, ui->clip_rect);
v4f32_t rect_color = primary_color_global; v4f32_t rect_color = primary_color_global;
if (!v4f32_is_null(box->background_color)) rect_color = box->background_color; 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_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)); 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_text_align(ui_text_align_left)
ui_set_top(item_box) { ui_set_top(item_box) {
for (i32 i = 0; i < lengthof(tweak_table); i += 1) { for (i32 i = 0; i < lengthof(tweak_table); i += 1) {
mt_tweak_t *tweak = tweak_table + i; 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) { if (tweak->type->kind == type_kind_b32) {
b32 *n = (b32 *)tweak->ptr; 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)); ui_serial_type(&ui_test_event, type(app_event_t));
} }
locl f32 scroller_value;
// @todo: fix scroller to match mouse // @todo: fix scroller to match mouse
defer_block(ui_push_top(scroller_box), ui_pop_top()) { defer_block(ui_push_top(scroller_box), ui_pop_top()) {
f32 item_count = (f32)item_box->node_count; f32 item_count = (f32)item_box->node_count;

View File

@@ -13,25 +13,34 @@
[?] wasm (explore) [?] wasm (explore)
[ ] win32 [ ] win32
[ ] linux [ ] linux
[ ] gfx
[ ] simple 2d [ ] render
[ ] revisit api [ ] fix opengl warnings on win32
[x] change name, hard to type [ ] wasm (maybe try first without opengl and then opengl) <<<<<<<<<<<
[ ] ui [ ] ui
[ ] text input [ ] text input
[ ] everything lister (with edits etc.)
[ ] demo style, with different buttons and controls, headings
[ ] palette idea, also push pop palette
[ ] push pop flag
[ ] color picker [ ] color picker
[ ] slider [ ] slider
[ ] custom image as part of design [ ] draw image in box ui
[ ] demo with different buttons and controls, headings
[ ] core [ ] core
[ ] ast
[ ] move to core layer at some point as the abstract format for different types of serialization
[ ] use bit fields instead of ast_flag
[ ] mt_tag syntax // f32 value; mt_tag(min = 0, min = 10) // mt_tag(something)
[ ] remove most flags
[ ] explore metadata flags for common formats aka (key_value, list etc.. will
[ ] json format
[ ] ini format
[x] remove dates and time from core [x] remove dates and time from core
[ ] meta [ ] meta
[x] prototype something like templates, readable string generation [x] prototype something like templates, readable string generation
[ ] mt_tag syntax // f32 value; mt_tag(min = 0, min = 10) // mt_tag(something)
[ ] remove flags
[x] search for python snippets and execute meta.py script on that file [x] search for python snippets and execute meta.py script on that file
[x] simplify logging!!!! [x] simplify logging!!!!
[x] somehow index properly the meta files and ignore generated files [x] somehow index properly the meta files and ignore generated files