Skip to content

Commit

Permalink
prevent clicks from passing
Browse files Browse the repository at this point in the history
fix #6
  • Loading branch information
ericoporto committed Feb 16, 2021
1 parent d2a12b5 commit 988a825
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion imgi_demo/imgi.asc
Original file line number Diff line number Diff line change
Expand Up @@ -2228,7 +2228,7 @@ void on_event (EventType event, int data)

ImGi_Mouse_Button btn_click;
void on_mouse_click(MouseButton button)
{
{
btn_click = eImGi_Mouse_Left*(button==eMouseLeft) +
eImGi_Mouse_Right*(button==eMouseRight) +
eImGi_Mouse_Middle*(button==eMouseMiddle);
Expand All @@ -2240,6 +2240,18 @@ void on_mouse_click(MouseButton button)
_ImGi.scroll_delta_x += 16;
_ImGi.scroll_delta_y += 16;
}

// prevent clicks from passing through visible containers
for(int i=0; i<_ImGi.stk_root_index; i++)
{
ImGi_Container* cnt = _ImGi.stk_root_items[i];
if(cnt != null &&
cnt.open &&
_Rect_Overlaps_Point(cnt.rect_x, cnt.rect_y, cnt.rect_w, cnt.rect_h, mouse.x, mouse.y))
{
ClaimEvent();
}
}
}

void on_key_press (eKeyCode keycode)
Expand Down

0 comments on commit 988a825

Please sign in to comment.