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

In egui 0.21.0, but not before, bottom panel slowly grows if radio buttons try to expand it #2796

Open
John-Nagle opened this issue Mar 10, 2023 · 1 comment
Labels
bug Something is broken

Comments

@John-Nagle
Copy link

Describe the bug
Here we have a game-type interface, with a TopBottomPanel menu bar at the top and a TopBottomPanel band of widgets at the bottom.
The bottom panel has a translucent grey background. It's suppose to size itself to the content.

Sizing worked prior to egui 0.21.0, but in 0.21.0, something very strange happens. Note the column of radio buttons, "Walk/Run/Fly". That column is slightly higher than the other widgets in the bar. The bar expands upward, and keeps slowly expanding until it fills the whole screen. See picture.

Relevant egui code is:

        egui::Frame::none()
            .fill(PANEL_BACKGROUND_COLOR)
            .rounding(OUTLINE_BOX_ROUNDING)
            .show(ui, |ui| {
            ui.horizontal_top(|ui| {
                ui.vertical(|ui| {
                        // Walk/run/fly
                        ui.radio_value(&mut walk_mode, WalkMode::Walk, t!("menu.walk", dict));
                        ui.radio_value(&mut walk_mode, WalkMode::Run, t!("menu.run", dict));
                        ui.radio_value(&mut walk_mode, WalkMode::Fly, t!("menu.fly", dict));
                        }

The enclosing TopBottomPanel code:

           //  Bottom button panel
            egui::TopBottomPanel::bottom("bottom_panel")
                .frame(Frame::none().fill(TRANSLUCENT_GREY_COLOR32))
                .show(&ctx, |ui| {
                    ui.visuals_mut().widgets.inactive.bg_fill = egui::Color32::TRANSPARENT; // transparent button background
                    ui.with_layout(egui::Layout::bottom_up(egui::Align::LEFT), |ui| {
                        ui.horizontal(|ui| {
                            //  Basic camera controls -- orbit, zoom, move
                            ui.add_space(OUTLINE_BOX_ROUNDING); // allow extra space before next item ***TEMP***
                            self.panel_camera.draw(ui, state);
                            //  Movement controls - walk, run, fly, stand.
                            ui.add_space(OUTLINE_BOX_ROUNDING); // allow extra space before next item ***TEMP***
                            self.panel_movement.draw(ui, state);
                            //  Chat controls - input text box
                            ui.add_space(OUTLINE_BOX_ROUNDING); // allow extra space before next item ***TEMP***
                            self.panel_chat.draw(ui, state);
                        })                
                    });
                });

self.panel_movement.draw(ui, state) is drawing the 3 radio buttons. Everything else expands the bottom bar as needed, but it doesn't

All this is running on top of Rend3 and rend3-egui, on Ubuntu Linux 20.04 LTS. Standalone application, not in a browser.

To Reproduce
Don't have a standalone test case, sorry.

Expected behavior
The TopBottomPanel.bottom() should be expanded to include all the radio buttons.

Screenshotscreepingbottompanel

Desktop (please complete the following information):

  • OS: Ubuntu Linux
  • Version 20.04 LTS

Additional context
I may not be doing the layout in the ideal way, but this behavior is so weird it should be reported.

@John-Nagle John-Nagle added the bug Something is broken label Mar 10, 2023
@John-Nagle John-Nagle changed the title In egui 0.15, but not before, bottom panel slowly grows if radio buttons try to expand it In egui 0.21.0, but not before, bottom panel slowly grows if radio buttons try to expand it Mar 11, 2023
@John-Nagle
Copy link
Author

This seems to be related to using bottom_up. If I do everything top_down, it works right. So I will stick to top_down for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

No branches or pull requests

1 participant