egui/crates/egui-winit
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
..
src Allow users to create viewports larger than monitor on Windows & macOS (#4337) 2024-04-22 12:44:21 +02:00
CHANGELOG.md Release 0.27.2 - Fix blurry web rendering 2024-04-02 18:18:43 +02:00
Cargo.toml Update memoffset to 0.9.0, arboard to 3.3.1, and remove egui_glow's needless dependency on pure_glow's deps (#4036) 2024-02-13 10:32:18 +01:00
README.md Remove misleading safety-badges 2023-02-28 22:35:08 +01:00

README.md

egui-winit

Latest version Documentation MIT Apache

This crates provides bindings between egui and winit.

The library translates winit events to egui, handled copy/paste, updates the cursor, open links clicked in egui, etc.