Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

egui flex FlexJustify options doesn't work #41

Closed
PPakalns opened this issue Oct 4, 2024 · 3 comments
Closed

egui flex FlexJustify options doesn't work #41

PPakalns opened this issue Oct 4, 2024 · 3 comments

Comments

@PPakalns
Copy link

PPakalns commented Oct 4, 2024

Testing out egui_flex.

I can not get egui_flex::FlexJustify::SpaceBetween or SpaceAround to work and fully fill one line with leaving large gaps empty.
Wanted to create the following effect: https://css-tricks.com/wp-content/uploads/2018/10/justify-content.svg

        egui::TopBottomPanel::top("menu")
            .resizable(false)
            .show(ctx, |ui| {
                ui.set_width(1000.); // Tried to manually give space for egui flex
                egui_flex::Flex::horizontal()
                    .justify(egui_flex::FlexJustify::SpaceAround)
                    .show(ui, |flex| {
                        flex.add(egui_flex::item(), egui::Label::new("test1"));
                        flex.add(egui_flex::item(), egui::Label::new("test2"));
                        flex.add(egui_flex::item(), egui::Label::new("test3"));
                    });
              });

From source code it looks like property can be defined, but support is not implemented.

@PPakalns PPakalns changed the title egui flex FlexJustify options do not work egui flex FlexJustify options doesn't work Oct 4, 2024
@lucasmerlin
Copy link
Owner

Ah, good catch, it seems I just forgot about those. Do you have a need for them or were you just trying things out?
Right now you should be able to emulate the effects by adding empty items with flex grow in-between your items

@PPakalns
Copy link
Author

PPakalns commented Oct 4, 2024

Thank you, this workaround works really well!

When width is too small, workaround doesn't work correctly when items are placed in multiple rows.

@lucasmerlin
Copy link
Owner

Flex justify has been implemented in #44 😄

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

No branches or pull requests

2 participants