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
lucasmerlin and others added 9 commits September 4, 2025 12:39
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.
Turns out the default timeout for github actions is 6 hours (!). This PR
sets some reasonable default for all workflows, the ones invoking cargo
in some way are limited to 60 minutes and the remaining ones to
10-15mins.
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.

Nice! But we should add some note that explains that main_justify breaks when adding more than a single element and then only show a single widget when main_justify is enabled.

The warning disappears when main wrap is set, and when resize area is restricted unless main justify is set.
The label will appear as long as the user is within one step of triggering the infinite auto-resize.
@justincredible
Copy link
Author

layout.mp4

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