Skip to content

Conversation

@emilk
Copy link
Owner

@emilk emilk commented Nov 16, 2025

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

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
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
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
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
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
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
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.

3 participants