egui/crates/emath/src
Emil Ernerfeldt 1571027556
Replace `eframe::Frame` commands and `WindowInfo` with egui (#3564)
* Part of https://github.com/emilk/egui/issues/3556

## In short
You now almost never need to use `eframe::Frame` - instead use
`ui.input(|i| i.viewport())` for information about the current viewport
(native window), and use `ctx.send_viewport_cmd` to modify it.

## In detail

This PR removes most commands from `eframe::Frame`, and replaces them
with `ViewportCommand`.
So `frame.close()` becomes
`ctx.send_viewport_cmd(ViewportCommand::Close)`, etc.

`frame.info().window_info` is now also gone, replaced with `ui.input(|i|
i.viewport())`.

`frame.info().native_pixels_per_point` is replaced with `ui.input(|i|
i.raw.native_pixels_per_point)`.

`RawInput` now contains one `ViewportInfo` for each viewport.

Screenshots are taken with
`ctx.send_viewport_cmd(ViewportCommand::Screenshots)` and are returned
in `egui::Event` which you can check with:

``` ust
ui.input(|i| {
    for event in &i.raw.events {
        if let egui::Event::Screenshot { viewport_id, image } = event {
            // handle it here
        }
    }
});
```

### Motivation
You no longer need to pass around the `&eframe::Frame` everywhere.
This also opens the door for other integrations to use the same API of
`ViewportCommand`s.
2023-11-18 19:27:53 +01:00
..
align.rs Replace uses of `RangeInclusive<f32>` with `emath::Rangef` (#3221) 2023-08-10 13:07:00 +02:00
history.rs Move egui::util::History to emath::History (#2329) 2022-11-21 14:14:33 +01:00
lib.rs Replace `Id::null()` with `Id::NULL` (#3544) 2023-11-11 21:40:02 +01:00
numeric.rs Move all crates into a `crates` directory (#1940) 2022-08-20 10:41:49 +02:00
pos2.rs Replace `eframe::Frame` commands and `WindowInfo` with egui (#3564) 2023-11-18 19:27:53 +01:00
range.rs Update hyperlink doc (#3561) 2023-11-18 17:13:03 +01:00
rect.rs Replace `eframe::Frame` commands and `WindowInfo` with egui (#3564) 2023-11-18 19:27:53 +01:00
rect_transform.rs Enable and fix some more clippy lints 2022-12-05 09:29:59 +01:00
rot2.rs Increase MSRV to 1.67 (#3234) 2023-08-11 13:54:02 +02:00
smart_aim.rs Move all crates into a `crates` directory (#1940) 2022-08-20 10:41:49 +02:00
vec2.rs Use `impl Into<Stroke>` as argument in a few more places (#3420) 2023-11-10 21:36:51 +01:00
vec2b.rs Add `emath::Vec2b`, replacing `egui_plot::AxisBools` (#3543) 2023-11-11 21:31:36 +01:00