egui/crates
lopo ff8cfc2aa0
Allow users to create viewports larger than monitor on Windows & macOS (#4337)
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>
2024-04-22 12:44:21 +02:00
..
ecolor Add `emath::OrderedFloat` (moved from `epaint::util::OrderedFloat`) (#4389) 2024-04-21 20:36:32 +02:00
eframe Allow users to create viewports larger than monitor on Windows & macOS (#4337) 2024-04-22 12:44:21 +02:00
egui Allow users to create viewports larger than monitor on Windows & macOS (#4337) 2024-04-22 12:44:21 +02:00
egui-wgpu Release 0.27.2 - Fix blurry web rendering 2024-04-02 18:18:43 +02:00
egui-winit Allow users to create viewports larger than monitor on Windows & macOS (#4337) 2024-04-22 12:44:21 +02:00
egui_demo_app Rename "Color test" to "Rendering test", and restructure it slightly (#4298) 2024-04-01 13:08:52 +02:00
egui_demo_lib Rename "Color test" to "Rendering test", and restructure it slightly (#4298) 2024-04-01 13:08:52 +02:00
egui_extras Release 0.27.2 - Fix blurry web rendering 2024-04-02 18:18:43 +02:00
egui_glow Add `ViewportCommand::RequestCut`, `RequestCopy` and `RequestPaste` to trigger Clipboard actions (#4035) 2024-04-22 09:06:33 +02:00
egui_plot Add `emath::OrderedFloat` (moved from `epaint::util::OrderedFloat`) (#4389) 2024-04-21 20:36:32 +02:00
egui_web Fix typos (#2866) 2023-04-18 15:52:45 +02:00
emath Add `emath::OrderedFloat` (moved from `epaint::util::OrderedFloat`) (#4389) 2024-04-21 20:36:32 +02:00
epaint Add `emath::OrderedFloat` (moved from `epaint::util::OrderedFloat`) (#4389) 2024-04-21 20:36:32 +02:00