Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OverflowClipBox::MarginBox #16640

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ickshonpe
Copy link
Contributor

@ickshonpe ickshonpe commented Dec 4, 2024

Objective

Add support for clipping content overflowing a UI node's margin box.

Solution

  • Add a new field margin to ComputedNode which is updated in ui_layout_system from the margins computed by Taffy.
  • Add a MarginBox variant to the OverflowClipBox enum.
  • In update_clipping clip to the margin box when a node with OverflowClipBox::MarginBox is found.

Testing

I added an item demonstrating OverflowClipBox::MarginBox to the overflow_clip_margin example:

cargo run --example overflow_clip_margin
margin-box

… content outside a node's margin box.

`ComputedNode` has a new field `margin` which is updated in `ui_layout_system`.
The `OverflowClipBox` enum has a new variant `MarginBox` and `update_clipping` clips to the margin box when it finds a node with `OverflowClipBox::MarginBox` set.
@ickshonpe ickshonpe changed the title margin box overflow clipping OverflowClipBox::MarginBox Dec 4, 2024
@IQuick143 IQuick143 added C-Feature A new feature, making something new possible A-UI Graphical user interfaces, styles, layouts, and widgets S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Feature A new feature, making something new possible S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants