egui/crates
Emil Ernerfeldt a768d74411
Add `Ui::is_sizing_pass` for better size estimation of `Area`s, and menus in particular (#4557)
* Part of https://github.com/emilk/egui/issues/4535
* Closes https://github.com/emilk/egui/issues/3974

This adds a special `sizing_pass` mode to `Ui`, in which we have no
centered or justified layouts, and everything is hidden. This is used by
`Area` to use the first frame to measure the size of its contents so
that it can then set the perfectly correct size the subsequent frames.

For menus, where buttons are justified (span the full width), this
finally the problem of auto-sizing. Before you would have to pick a
width manually, and all buttons would expand to that width. If it was
too wide, it looked weird. If it was too narrow, text would wrap. Now
all menus are exactly the width they need to be. By default menus will
wrap at `Spacing::menu_width`.

This affects all situations when you have something that should be as
small as possible, but still span the full width/height of the parent.
For instance: the `egui::Separator` widget now checks the
`ui.is_sizing_pass` flag before deciding on a size. In the sizing pass a
horizontal separator is always 0 wide, and only in subsequent passes
will it span the full width.
2024-05-29 10:27:04 +02:00
..
ecolor Move dependencies to workspace (#4495) 2024-05-14 11:02:49 +02:00
eframe Support returning errors when creating the app (#4565) 2024-05-28 21:59:19 +02:00
egui Add `Ui::is_sizing_pass` for better size estimation of `Area`s, and menus in particular (#4557) 2024-05-29 10:27:04 +02:00
egui-wgpu Revert update to wgpu 0.20 => downgrade to wgpu 0.19.1 (#4559) 2024-05-28 14:40:43 +02:00
egui-winit Do no use the ahash reimport (#4504) 2024-05-27 16:24:50 +02:00
egui_demo_app Support returning errors when creating the app (#4565) 2024-05-28 21:59:19 +02:00
egui_demo_lib Add `Ui::is_sizing_pass` for better size estimation of `Area`s, and menus in particular (#4557) 2024-05-29 10:27:04 +02:00
egui_extras Do no use the ahash reimport (#4504) 2024-05-27 16:24:50 +02:00
egui_glow Do no use the ahash reimport (#4504) 2024-05-27 16:24:50 +02:00
egui_plot Add support for text truncation to `egui::Style` (#4556) 2024-05-28 13:10:41 +02:00
egui_web Fix typos (#2866) 2023-04-18 15:52:45 +02:00
emath Add `Ui::is_sizing_pass` for better size estimation of `Area`s, and menus in particular (#4557) 2024-05-29 10:27:04 +02:00
epaint Add support for text truncation to `egui::Style` (#4556) 2024-05-28 13:10:41 +02:00