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

Resizing window changes some widgets size whereas it shouldn't #773

Closed
GuillaumeGomez opened this issue Oct 6, 2021 · 3 comments
Closed
Labels
bug Something is broken layout Related to widget layout

Comments

@GuillaumeGomez
Copy link
Contributor

A small video of the bug:

Peek.2021-10-06.22-15.mp4

The code I used:

egui::Window::new("Character").collapsible(false).show(&egui_ctx, |ui| {
    let player = &players[0];

    ui.label("Character imperio");
    ui.separator();

    egui::Grid::new("chracter_infos").show(ui, |ui| {
        ui.label("Level");
        ui.label(&player.level.to_string());
        ui.end_row();

        ui.label("Experience");
        ui.label(&format!("{} / {}", player.xp, player.xp_to_next_level));
        ui.end_row();

        ui.label("Health");
        ui.label(&player.health.to_string());
        ui.end_row();

        ui.label("Stamina");
        ui.label(&player.stamina.to_string());
        ui.end_row();

        ui.label("Mana");
        ui.label(&player.mana.to_string());
        ui.end_row();
    });
});

Thanks a lot for this crate, it's really great!

@GuillaumeGomez GuillaumeGomez added the bug Something is broken label Oct 6, 2021
@Bromeon
Copy link
Contributor

Bromeon commented Jan 19, 2022

Also happens in the Table Test demo in latest master (commit e4aa1e6).
What's interesting is that it resizes one, but not all separators:

Resizing.mp4

A similar, but maybe not the same issue: #762

@emilk
Copy link
Owner

emilk commented Jan 21, 2022

This is a consequence of immediate mode. You make the window narrower, so all contained widgets try to fit within this smaller size. The first few widgets can fit, but the later can't, so the window expands to fit the wider widgets.

I see no obvious way of fixing this except for multipass layout.

@emilk emilk added the layout Related to widget layout label Jan 21, 2022
@emilk
Copy link
Owner

emilk commented Jan 21, 2022

@emilk emilk closed this as completed Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken layout Related to widget layout
Projects
None yet
Development

No branches or pull requests

3 participants