egui icon indicating copy to clipboard operation
egui copied to clipboard

The main window is not centered correctly when the scale factor is not 1.

Open zhatuokun opened this issue 2 years ago • 0 comments

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:

  1. cargo new example
  2. add eframe = "0.20.0"
  3. 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

zhatuokun avatar Dec 27 '22 10:12 zhatuokun