egui/crates
Antoine Beyeler 365a8d2240
Fix `Window` positioning bug when bad `pivot` is stored in app data (#3721)
This PR fixes an issue where a bad pivot stored in app state would
override the pivot actually set from code. The root code of this issue
if the `Window`'s `State` containing `pivot` in the first place, as
`pivot` is not part of a state to be tracked. It makes the `State`
structure more ergonomic though, so this PR leaves the `pivot` field but
always overrides it with the value provided by user code.

#### Repro of the original issue

This issue can be reproduced using the `re_ui_example` app from the
Rerun repo, at this commit:
fb5add0047.
By using this `app.ron` file, the bug will appear:

```
{
    "egui": "(
      areas:{
            ((0)):(
                areas:{
                    (13430889033718688666):(pivot_pos:(x:565.5,y:328.0),pivot:((Min,Min)),size:(x:364.0,y:75.5),interactable:true),
                },
            )
        }
    )",
}
```

The modal is entered based on it's top-left corner even though the code
actually specifies a center-center pivot:

<img width="1312" alt="image"
src="https://github.com/emilk/egui/assets/49431240/6df1a8bb-d1ea-4e15-866c-5f14138dda0e">

With this PR, the centring is correct even with the "poisoned"
`app.ron`:

<img width="1312" alt="image"
src="https://github.com/emilk/egui/assets/49431240/7f50b2d4-9245-48f3-91de-c747bbc8c40e">
2023-12-23 15:53:40 +01:00
..
ecolor Typos and doc improvements 2023-12-22 17:33:01 +01:00
eframe Typos and doc improvements 2023-12-22 17:33:01 +01:00
egui Fix `Window` positioning bug when bad `pivot` is stored in app data (#3721) 2023-12-23 15:53:40 +01:00
egui-wgpu Update to winit 0.29 (#3649) 2023-12-18 14:53:14 +01:00
egui-winit Update to winit 0.29 (#3649) 2023-12-18 14:53:14 +01:00
egui_demo_app Replace a special `Color32::PLACEHOLDER` with widget fallback color (#3727) 2023-12-22 15:09:10 +01:00
egui_demo_lib Replace a special `Color32::PLACEHOLDER` with widget fallback color (#3727) 2023-12-22 15:09:10 +01:00
egui_extras Update resvg dependency of egui_extras (#3719) 2023-12-20 08:09:03 +01:00
egui_glow Update to glow 0.13 (#3715) 2023-12-18 15:15:20 +01:00
egui_plot Replace a special `Color32::PLACEHOLDER` with widget fallback color (#3727) 2023-12-22 15:09:10 +01:00
egui_web Fix typos (#2866) 2023-04-18 15:52:45 +02:00
emath Add a bunch of `#[inline]` 2023-12-18 17:28:47 +01:00
epaint Replace a special `Color32::PLACEHOLDER` with widget fallback color (#3727) 2023-12-22 15:09:10 +01:00