formal drop-hot mechanism in ui core; further cleanup/fixes in drop-split combined operation ui

This commit is contained in:
Ryan Fleury
2024-04-29 11:06:18 -07:00
parent 15a2e708a0
commit d419c6e15c
3 changed files with 276 additions and 78 deletions
+38
View File
@@ -602,6 +602,12 @@ ui_active_key(UI_MouseButtonKind button_kind)
return ui_state->active_box_key[button_kind];
}
internal UI_Key
ui_drop_hot_key(void)
{
return ui_state->drop_hot_box_key;
}
//- rjf: controls over interaction
internal void
@@ -982,6 +988,11 @@ ui_begin_build(OS_EventList *events, OS_Handle window, UI_NavActionList *nav_act
}
}
//- rjf: reset drop-hot key
{
ui_state->drop_hot_box_key = ui_key_zero();
}
//- rjf: reset active if our active box is disabled
for(EachEnumVal(UI_MouseButtonKind, k))
{
@@ -2723,6 +2734,33 @@ ui_signal_from_box(UI_Box *box)
}
}
//////////////////////////////
//- rjf: mouse is over this box's rect, drop site, no other drop hot key? -> set drop hot key
//
{
if(box->flags & UI_BoxFlag_DropSite &&
contains_2f32(rect, ui_state->mouse) &&
!contains_2f32(blacklist_rect, ui_state->mouse) &&
!ui_key_match(ui_state->active_box_key[UI_MouseButtonKind_Left], ui_key_zero()) &&
(ui_key_match(ui_state->drop_hot_box_key, ui_key_zero()) || ui_key_match(ui_state->drop_hot_box_key, box->key)))
{
ui_state->drop_hot_box_key = box->key;
}
}
//////////////////////////////
//- rjf: mouse is not over this box's rect, but this is the drop hot key? -> zero drop hot key
//
{
if(box->flags & UI_BoxFlag_DropSite &&
(!contains_2f32(rect, ui_state->mouse) ||
contains_2f32(blacklist_rect, ui_state->mouse)) &&
ui_key_match(ui_state->drop_hot_box_key, box->key))
{
ui_state->drop_hot_box_key = ui_key_zero();
}
}
//////////////////////////////
//- rjf: clicking on something outside the context menu kills the context menu
//