Skip to content

Panel: never overflow available width, nor max_width#8198

Merged
emilk merged 7 commits into
mainfrom
emilk/clamp-panel-size
May 26, 2026
Merged

Panel: never overflow available width, nor max_width#8198
emilk merged 7 commits into
mainfrom
emilk/clamp-panel-size

Conversation

@emilk
Copy link
Copy Markdown
Owner

@emilk emilk commented May 25, 2026

This changes the behavior of Panel to NEVER overflow Panel::max_size, nor the available space in the parent UI.

If you do overflow it, the content will be silently clipped.

@emilk emilk requested a review from lucasmerlin as a code owner May 25, 2026 12:28
@emilk emilk added bug Something is broken layout Related to widget layout egui labels May 25, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 25, 2026

Preview available at https://egui-pr-preview.github.io/pr/8198-emilkclamp-panel-size
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

View snapshot changes at kitdiff

@emilk emilk force-pushed the emilk/clamp-panel-size branch from 2c843a0 to 2a66e7f Compare May 25, 2026 13:26
@emilk emilk added this to the 0.35.0 milestone May 25, 2026
Copy link
Copy Markdown
Collaborator

@lucasmerlin lucasmerlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Comment on lines +658 to +662
let mut outer_rect = {
let mut outer_rect = available_rect;
self.side.set_rect_size(&mut outer_rect, outer_size);
outer_rect
};
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let mut outer_rect = {
let mut outer_rect = available_rect;
self.side.set_rect_size(&mut outer_rect, outer_size);
outer_rect
};
let mut outer_rect = available_rect;
self.side.set_rect_size(&mut outer_rect, outer_size);

@lucasmerlin lucasmerlin modified the milestones: 0.35.0, 0.34.4, 0.34.3 May 26, 2026
@emilk emilk removed this from the 0.34.3 milestone May 26, 2026
@emilk
Copy link
Copy Markdown
Owner Author

emilk commented May 26, 2026

I don't think this should be in a patch release - I worry this will change the behavior of some existing code, but I'm not 100% sure

@emilk emilk merged commit 0ce2b36 into main May 26, 2026
46 checks passed
@emilk emilk deleted the emilk/clamp-panel-size branch May 26, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something is broken egui layout Related to widget layout

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resizable Panel stores and paints using overflowed inner rect instead of clamped panel rect

2 participants