Skip to content

Commit

Permalink
ui: clip whole subtree when box is outside clip and doesn't allow chi…
Browse files Browse the repository at this point in the history
…ldren to overflow
  • Loading branch information
martinfouilleul committed Feb 18, 2025
1 parent aee1ddb commit 32c85db
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/ui/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -2892,6 +2892,15 @@ void oc_ui_draw_box(oc_ui_box* box)
}
}

if(!draw
&& box->style.layout.overflow.x != OC_UI_OVERFLOW_ALLOW
&& box->style.layout.overflow.y != OC_UI_OVERFLOW_ALLOW)
{
//NOTE: box is outside current clip and clips its children, so we can clip the
// whole subtree
return;
}

{
//NOTE: push clip rect
oc_rect clipRect = oc_ui_box_clip_rect(box);
Expand Down

0 comments on commit 32c85db

Please sign in to comment.