tooltip coverage for all command evaluations, major top-bar simplification, anchored tooltips

This commit is contained in:
Ryan Fleury
2025-05-01 14:09:05 -07:00
parent e3f68622f7
commit b20f003e7f
7 changed files with 144 additions and 242 deletions
+17
View File
@@ -805,6 +805,7 @@ ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, U
ui_state->ctx_menu_changed = 0;
ui_state->default_animation_rate = 1 - pow_f32(2, (-60.f * ui_state->animation_dt));
ui_state->tooltip_can_overflow_window = 0;
ui_state->tooltip_anchor_key = ui_key_zero();
ui_state->tags_key_stack_top = ui_state->tags_key_stack_free = 0;
ui_state->tags_cache_slots_count = 512;
ui_state->tags_cache_slots = push_array(ui_build_arena(), UI_TagsCacheSlot, ui_state->tags_cache_slots_count);
@@ -1248,6 +1249,22 @@ ui_end_build(void)
}
}
//- rjf: anchor tooltips
if(!ui_key_match(ui_state->tooltip_anchor_key, ui_key_zero()))
{
UI_Box *anchor_box = ui_box_from_key(ui_state->tooltip_anchor_key);
if(!ui_box_is_nil(anchor_box))
{
ui_state->tooltip_root->rect.x0 = anchor_box->rect.x0;
ui_state->tooltip_root->rect.y0 = anchor_box->rect.y1 + anchor_box->font_size*0.5f;
}
else
{
ui_state->tooltip_root->rect.x0 = 10000;
ui_state->tooltip_root->rect.y0 = 10000;
}
}
//- rjf: ensure special floating roots are within screen bounds
UI_Box *floating_roots[] = {ui_state->tooltip_root, ui_state->ctx_menu_root};
B32 force_contain[] =
+1
View File
@@ -676,6 +676,7 @@ struct UI_State
//- rjf: build state machine state
B32 is_in_open_ctx_menu;
B32 tooltip_can_overflow_window;
UI_Key tooltip_anchor_key;
String8Array current_gen_tags;
U64 current_gen_tags_gen;
UI_TagsKeyStackNode *tags_key_stack_top;