Skip to content

Commit

Permalink
On composite click, make the child the focus only if the leaf-most el…
Browse files Browse the repository at this point in the history
…ement clicked wants to be focus.
  • Loading branch information
djowel committed Jan 30, 2024
1 parent 9f24ff1 commit 5db445d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/src/element/composite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ namespace cycfi { namespace elements
if (btn.down) // button down
{
hit_info info = hit_element(ctx, btn.pos, true);
if (info.element_ptr)
if (info.element_ptr && info.leaf_element_ptr)
{
if (info.element_ptr->wants_focus() && _focus != info.index)
if (info.leaf_element_ptr->wants_focus() && _focus != info.index)
new_focus(ctx, info.index, restore_previous);

context ectx{ctx, info.element_ptr, info.bounds};
Expand Down

0 comments on commit 5db445d

Please sign in to comment.