mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 22:30:03 -04:00
Add Galley::intrinsic_size and use it in AtomLayout (#7146)
- part of https://github.com/emilk/egui/issues/5762 - also allows me to simplify sizing logic in egui_flex
This commit is contained in:
@@ -81,11 +81,10 @@ impl<'a> AtomKind<'a> {
|
||||
) -> (Vec2, SizedAtomKind<'a>) {
|
||||
match self {
|
||||
AtomKind::Text(text) => {
|
||||
let galley = text.into_galley(ui, wrap_mode, available_size.x, TextStyle::Button);
|
||||
(
|
||||
galley.size(), // TODO(#5762): calculate the preferred size
|
||||
SizedAtomKind::Text(galley),
|
||||
)
|
||||
let wrap_mode = wrap_mode.unwrap_or(ui.wrap_mode());
|
||||
let galley =
|
||||
text.into_galley(ui, Some(wrap_mode), available_size.x, TextStyle::Button);
|
||||
(galley.intrinsic_size, SizedAtomKind::Text(galley))
|
||||
}
|
||||
AtomKind::Image(image) => {
|
||||
let size = image.load_and_calc_size(ui, available_size);
|
||||
|
||||
Reference in New Issue
Block a user