mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
allow fall-through clicks on context menus; fix busted context menu sizing in theme color popup
This commit is contained in:
@@ -8596,7 +8596,8 @@ DF_VIEW_UI_FUNCTION_DEF(Theme)
|
||||
color < DF_ThemeColor_COUNT;
|
||||
color = (DF_ThemeColor)(color+1))
|
||||
{
|
||||
UI_PrefWidth(ui_em(28.5f, 1)) UI_PrefHeight(ui_children_sum(1.f)) UI_CtxMenu(color_ctx_menu_keys[color]) UI_Padding(ui_em(1.5f, 1.f))
|
||||
UI_CtxMenu(color_ctx_menu_keys[color]) UI_Padding(ui_em(1.5f, 1.f))
|
||||
UI_PrefWidth(ui_em(28.5f, 1)) UI_PrefHeight(ui_children_sum(1.f))
|
||||
{
|
||||
// rjf: build title
|
||||
UI_Row
|
||||
|
||||
+18
-12
@@ -903,7 +903,7 @@ ui_begin_build(OS_EventList *events, OS_Handle window, UI_NavActionList *nav_act
|
||||
UI_FixedX(anchor.x) UI_FixedY(anchor.y) UI_PrefWidth(ui_children_sum(1.f)) UI_PrefHeight(ui_children_sum(1.f)) UI_Focus(ui_state->ctx_menu_open)
|
||||
{
|
||||
ui_set_next_child_layout_axis(Axis2_Y);
|
||||
ui_state->ctx_menu_root = ui_build_box_from_stringf(UI_BoxFlag_DrawDropShadow|(ui_state->ctx_menu_open*UI_BoxFlag_DefaultFocusNavY), "###ctx_menu_%I64x", window.u64[0]);
|
||||
ui_state->ctx_menu_root = ui_build_box_from_stringf(UI_BoxFlag_Clickable|UI_BoxFlag_DrawDropShadow|(ui_state->ctx_menu_open*UI_BoxFlag_DefaultFocusNavY), "###ctx_menu_%I64x", window.u64[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1015,16 +1015,6 @@ ui_end_build(void)
|
||||
ui_ctx_menu_close();
|
||||
}
|
||||
|
||||
//- rjf: close ctx menu if unconsumed clicks
|
||||
for(OS_Event *event = ui_events()->first; event != 0; event = event->next)
|
||||
{
|
||||
if(event->kind == OS_EventKind_Press && os_handle_match(event->window, ui_window()) &&
|
||||
(event->key == OS_Key_LeftMouseButton || event->key == OS_Key_RightMouseButton))
|
||||
{
|
||||
ui_ctx_menu_close();
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: stick ctx menu to anchor
|
||||
if(ui_state->ctx_menu_touched_this_frame)
|
||||
{
|
||||
@@ -1214,6 +1204,22 @@ ui_end_build(void)
|
||||
root->rect.y1 = root->rect.y0 + dim_2f32(rect).y * ui_state->ctx_menu_open_t;
|
||||
}
|
||||
|
||||
//- rjf: fall-through interact with context menu
|
||||
if(ui_state->ctx_menu_open)
|
||||
{
|
||||
ui_signal_from_box(ui_state->ctx_menu_root);
|
||||
}
|
||||
|
||||
//- rjf: close ctx menu if unconsumed clicks
|
||||
for(OS_Event *event = ui_events()->first; event != 0; event = event->next)
|
||||
{
|
||||
if(event->kind == OS_EventKind_Press && os_handle_match(event->window, ui_window()) &&
|
||||
(event->key == OS_Key_LeftMouseButton || event->key == OS_Key_RightMouseButton))
|
||||
{
|
||||
ui_ctx_menu_close();
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: hover cursor
|
||||
{
|
||||
UI_Box *hot = ui_box_from_key(ui_state->hot_box_key);
|
||||
@@ -2304,7 +2310,7 @@ ui_signal_from_box(UI_Box *box)
|
||||
B32 ctx_menu_is_ancestor = 0;
|
||||
ProfScope("check context menu ancestor")
|
||||
{
|
||||
for(UI_Box *parent = box->parent; !ui_box_is_nil(parent); parent = parent->parent)
|
||||
for(UI_Box *parent = box; !ui_box_is_nil(parent); parent = parent->parent)
|
||||
{
|
||||
if(parent == ui_state->ctx_menu_root)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user