egui/crates/egui_demo_app/src
Emil Ernerfeldt 6607cd95f9
⚠️ `Frame` now includes stroke width as part of padding (#5575)
* Part of https://github.com/emilk/egui/issues/4019

`Frame` now includes the width of the stroke as part of its size. From
the new docs:

### `Frame` docs
The total (outer) size of a frame is `content_size + inner_margin +
2*stroke.width + outer_margin`.

Everything within the stroke is filled with the fill color (if any).

```text
+-----------------^-------------------------------------- -+
|                 | outer_margin                           |
|    +------------v----^------------------------------+    |
|    |                 | stroke width                 |    |
|    |    +------------v---^---------------------+    |    |
|    |    |                | inner_margin        |    |    |
|    |    |    +-----------v----------------+    |    |    |
|    |    |    |             ^              |    |    |    |
|    |    |    |             |              |    |    |    |
|    |    |    |<------ content_size ------>|    |    |    |
|    |    |    |             |              |    |    |    |
|    |    |    |             v              |    |    |    |
|    |    |    +------- content_rect -------+    |    |    |
|    |    |                                      |    |    |
|    |    +-------------fill_rect ---------------+    |    |
|    |                                                |    |
|    +----------------- widget_rect ------------------+    |
|                                                          |
+---------------------- outer_rect ------------------------+
```

The four rectangles, from inside to outside, are:
* `content_rect`: the rectangle that is made available to the inner
[`Ui`] or widget.
* `fill_rect`: the rectangle that is filled with the fill color (inside
the stroke, if any).
* `widget_rect`: is the interactive part of the widget (what sense
clicks etc).
* `outer_rect`: what is allocated in the outer [`Ui`], and is what is
returned by [`Response::rect`].

### Notes
This required rewriting a lot of the layout code for `egui::Window`,
which was a massive pain. But now the window margin and stroke width is
properly accounted for everywhere.
2025-01-04 10:29:22 +01:00
..
apps Add `Harness::new_eframe` and `TestRenderer` trait (#5539) 2025-01-02 17:48:39 +01:00
backend_panel.rs Keep track of why `request_discard` was called (#5134) 2024-09-20 09:17:52 +02:00
frame_history.rs Update MSRV to 1.80 (#5457) 2024-12-10 16:09:03 +01:00
lib.rs Add `Harness::new_eframe` and `TestRenderer` trait (#5539) 2025-01-02 17:48:39 +01:00
main.rs Use `profiling` crate to support more profiler backends (#5150) 2024-12-16 09:15:54 +01:00
web.rs Use canvas directly (#4780) 2024-07-15 18:59:15 +02:00
wrap_app.rs ⚠️ `Frame` now includes stroke width as part of padding (#5575) 2025-01-04 10:29:22 +01:00