Skip to content

Experiment with using cross_intrinsic_size bookkeeping in Placer #5762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lucasmerlin opened this issue Mar 4, 2025 · 1 comment · May be fixed by #5831
Open

Experiment with using cross_intrinsic_size bookkeeping in Placer #5762

lucasmerlin opened this issue Mar 4, 2025 · 1 comment · May be fixed by #5831
Assignees

Comments

@lucasmerlin
Copy link
Collaborator

lucasmerlin commented Mar 4, 2025

…as a potential solution to #5138

what does desired_size mean?
in case of text: longest width of the child label, at most max_width

calculate label width from galley

  • how does it work with ellipses?

Naming: Maybe desired_size?

@emilk emilk added this to egui Nov 20, 2024
@lucasmerlin lucasmerlin converted this from a draft issue Mar 4, 2025
@lucasmerlin lucasmerlin self-assigned this Mar 4, 2025
@lucasmerlin
Copy link
Collaborator Author

lucasmerlin commented Mar 12, 2025

I've been experimenting with this here: master...lucas/experiments/measure-widget-size

I think the biggest source of complexity here is correctly determining the "preferred size" in each widget, as the calculations in e.g. Button tend to get quite complex with support for right text, images, etc..

I propose we introduce a WidgetLayout struct that handles laying out arbitray things (text, images, custom shape) inside a widget. This would remove a lot of complexity from each Widgets code and also make it easier to implement custom 3rd party widgets.
Also widgets get more flexible, as it would be trivial to e.g. create a button with an image on the right.

The layout calculation should be pretty basic, only horizontal, only allow a single item to shrink / wrap, just enough to implement all the current widgets.

Calculation of the preferred_size could then be handled there transparently to each widget.

I made a prototype of this here:
master...lucas/experiments/widget_layout

@lucasmerlin lucasmerlin linked a pull request Mar 20, 2025 that will close this issue
@lucasmerlin lucasmerlin moved this from In progress to Next up in egui Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Next up
Development

Successfully merging a pull request may close this issue.

1 participant