mirror of https://github.com/emilk/egui.git
Browse Source
Added clamp_size_to_monitor_size field on ViewportBuilder, which means whether clamp the window's size to monitor's size. (default to `true`) * Closes https://github.com/emilk/egui/issues/3389 ### simple example ```rust pub struct MyApp {} impl MyApp { pub fn new() -> MyApp { MyApp {} } } impl eframe::App for MyApp { fn update(&mut self, ctx: &Context, frame: &mut eframe::Frame) { egui::CentralPanel::default() .frame(Frame::none().fill(Color32::DARK_GRAY)) .show(ctx, |ui| { if ctx.input(|i| i.key_pressed(Key::Escape)) { ctx.send_viewport_cmd(ViewportCommand::Close); } }); } } pub fn main() { let option = eframe::NativeOptions { viewport: ViewportBuilder::default() .with_position([10.0, 10.0]) .with_inner_size([3000.0, 2000.0]) .with_clamp_size_to_monitor_size(false), ..Default::default() }; eframe::run_native( "a large window app", option, Box::new(|ctx| Box::new(MyApp::new())), ).unwrap(); } ``` It works on my windows (with 3 monitors), but I don't have a test environment for macos --------- Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>pull/4394/head
lopo
7 months ago
committed by
GitHub
3 changed files with 40 additions and 6 deletions
Loading…
Reference in new issue