Skip to content

Add ScrollArea::content_margin#7722

Merged
emilk merged 3 commits intomainfrom
emilk/scroll-area-margin
Nov 18, 2025
Merged

Add ScrollArea::content_margin#7722
emilk merged 3 commits intomainfrom
emilk/scroll-area-margin

Conversation

@emilk
Copy link
Copy Markdown
Owner

@emilk emilk commented Nov 16, 2025

@emilk emilk added feature New feature or request egui labels Nov 16, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 16, 2025

Preview available at https://egui-pr-preview.github.io/pr/7722-emilkscroll-area-margin
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

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.

Neat!

let mut content_ui = ui.new_child(
UiBuilder::new()
.ui_stack_info(UiStackInfo::new(UiKind::ScrollArea))
.max_rect(content_max_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.

Can't we just do content_max_rect - content_margin here, to avoid the extra nested child Ui?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

oh yeah - good idea!

Copy link
Copy Markdown
Owner Author

@emilk emilk Nov 18, 2025

Choose a reason for hiding this comment

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

no, that affects inner_rect and so the scroll bars move…

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Too much hassle. I'll leave it as a future optimization 😞

@emilk emilk merged commit 178f3c9 into main Nov 18, 2025
46 of 47 checks passed
@emilk emilk deleted the emilk/scroll-area-margin branch November 18, 2025 14:30
Masterchef365 pushed a commit to Masterchef365/egui that referenced this pull request Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

egui feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants