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

How to center? #222

Closed
meanbeanmachine opened this issue Nov 5, 2023 · 1 comment
Closed

How to center? #222

meanbeanmachine opened this issue Nov 5, 2023 · 1 comment

Comments

@meanbeanmachine
Copy link

Shouldn't the following code center the widgets in the middle of the screen? Depending on the horiz/vert order, the two elements are either at the top of the screen or on the far left of the screen... never center.

Screenshot from 2023-11-05 11-18-51
Screenshot from 2023-11-05 11-19-44

    mut ctx: EguiContexts,
    mut exit: EventWriter<WindowCloseRequested>,
    error: Res<AppError>,
    window: Query<Entity, With<Window>>,
) {
    egui::CentralPanel::default().show(ctx.ctx_mut(), |ui| {
        ui.horizontal_centered(|ui| {
            ui.vertical_centered(|ui| {
                ui.label(error.0.to_string());
                if ui.button("Exit").clicked() {
                    exit.send(WindowCloseRequested {
                        window: window.single(),
                    });
                }
            });
        });
    });
}```
@mvlabat
Copy link
Owner

mvlabat commented Oct 6, 2024

Sorry, I didn't notice the issue in time. Not sure if it's still actual, in any case, it's a question about egui itself. I unfortunately don't know a quick answer for it either, so it's best to ask in their repo/discord.

@mvlabat mvlabat closed this as completed Oct 6, 2024
@mvlabat mvlabat closed this as not planned Won't fix, can't repro, duplicate, stale Oct 6, 2024
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