Fixed issue with ui_signal_from_box

Biggest win was getting the intial fixes for overlapping boxes.
Eventually I'll need to add support for sorting actives of top-most ancestors
(pretty much just remove from linked list and add to last position (adjust indices of adjacent and new top most, etc)
This commit is contained in:
2024-05-10 04:16:04 -04:00
parent 1afe74b4b5
commit 5b24e591eb
6 changed files with 74 additions and 21 deletions

View File

@ -138,6 +138,8 @@ UI_Box :: struct {
disabled_delta : f32,
style_delta : f32,
parent_index : i32,
// prev_computed : UI_Computed,
// prev_style : UI_Style,v
// mouse : UI_InteractState,
@ -276,6 +278,7 @@ ui_box_make :: proc( flags : UI_BoxFlags, label : string ) -> (^ UI_Box)
if parent != nil
{
dll_full_push_back( null_box, parent, curr_box )
curr_box.parent_index = parent.num_children
parent.num_children += 1
curr_box.parent = parent
}
@ -398,3 +401,11 @@ ui_parent_pop :: proc() {
@(deferred_none = ui_parent_pop)
ui_parent :: #force_inline proc( ui : ^UI_Box) { ui_parent_push( ui ) }
// Topmost ancestor that is not the root
ui_top_ancestor :: #force_inline proc "contextless" ( box : ^UI_Box ) -> (^UI_Box) {
using ui := get_state().ui_context
ancestor := box
for ; ancestor.parent != root; ancestor = ancestor.parent {}
return ancestor
}