egui
egui copied to clipboard
The main window is not centered correctly when the scale factor is not 1.
Describe the bug The main window is not centered correctly when the scale factor is not 1(my default 1.25).
To Reproduce Steps to reproduce the behavior:
cargo new example- add
eframe = "0.20.0" - run the following code
fn main() {
eframe::run_native(
"app_name",
eframe::NativeOptions {
centered: true,
initial_window_size: Some(eframe::egui::vec2(960.0, 670.0)),
..Default::default()
},
Box::new(|_| Box::new(Application::default())),
);
}
#[derive(Default)]
struct Application;
impl eframe::App for Application {
fn update(&mut self, ctx: &eframe::egui::Context, _frame: &mut eframe::Frame) {
eframe::egui::CentralPanel::default().show(ctx, |ui| {
ui.heading("Hello World");
});
}
}
Expected behavior The window is centered correctly.
Desktop (please complete the following information):
- OS: Windows10
- Version: 21H2