Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…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: rerun-io/rerun@fb5add0. 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">
- Loading branch information