lucasmerlin / hello_egui

A collection of useful crates for egui
https://lucasmerlin.github.io/hello_egui/
MIT License
361 stars 25 forks source link

Discussion, egui taffy and flex #35

Closed PPakalns closed 1 month ago

PPakalns commented 2 months ago

https://github.com/emilk/egui/issues/4378

I wanted to provide feedback for these great egui layouting approaches.

I have played around with egui taffy, tried some modifications.

One approach that seems to work nicely for layouting group of components is to embed them into Frame and ScrollArea. Then from Frame borders and ScrollAreaOutput real width, height can be retrieved that can be used to invalidate, recalculate layout for the next frame.

This allow for grow and shrink functionality to work. Sadly with some jitter, frame delay. (Will try to solve issue with: https://github.com/emilk/egui/pull/5059)


Will explore egui flex. Would be great if some kind of shrink functionality could be supported if, for example, in list of buttons largest button is removed, the space could be shrunk. Maybe response could provide optional minimal size feedback that could be used (even if custom widgets must be implemented to provide this information).

Thank you for your great work in this area!

lucasmerlin commented 2 months ago

in list of buttons largest button is removed, the space could be shrunk.

This should definitely work, what doesn't work is something like flex-shrink, where it checks all the items for their intrinsic size and then shrinks them to fit into the available space.