Skip to content

Conversation

justincredible
Copy link

@justincredible justincredible commented Aug 16, 2025

  • I have followed the instructions in the PR template

This change adds the main_align and main_justify options to the "Layout Test" demo window.
demo_layout_test

Since all Layout fields are being used I replaced the LayoutSettings struct, but it required uncommenting the serde cfg_attr derives. This was commented out in bf19eb2 (and the feature name subsequently kept up-to-date), but it's not clear to me why so I can revert that commit and just update the demo struct if necessary.

The button's size was increased to demonstrate the text alignment, and the Resize::max_size() works around auto-resizing for main_justify.

@justincredible
Copy link
Author

An alternative solution to the infinite auto-resize would be to use Ui::allocate_ui_with_layout() as is often recommended, but that's less desirable in this case as it can result in layouts that make main_justify look more broken:
main_justify_allocate_ui

Copy link

github-actions bot commented Sep 4, 2025

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

The resize region needs to be limited or else it expands beyond the
viewport boundaries when main justify is set. The button needs to be
larger than default to see the how alignment affects the components' text.
@justincredible justincredible marked this pull request as ready for review September 4, 2025 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants