Skip to content
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

Measure intrinsic_size in Placer #5831

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

lucasmerlin
Copy link
Collaborator

This is an attempt at fixing #5138 by bookkeeping an intrinsic_size in the placer that is then used by the Area to set the max_rect on the next frame.
This should allow us to remove the sizing_pass, meaning Area can dynamically adjust to the content size while supporting justified and centered layouts.
This is very much WIP and there are still lots of open questions.

From my expermimentation it seems the biggest risk here is correctly implementing the intrinsic size calculation for every widget and container, which today can't be done automatically since every widget does it's own thing here (e.g. Button has right_text and image, which need to be handled correctly). This took me on a detour finding a abstraction on intra widget layout, resulting in #5830, which is very exiting in general and should also make building custom widgets a lot easier.
This layout thing could then also implement the intrinsic size calculation, meaning we only need to calculate it separately for containers.

Having the instrinsic size should also allow future improvements in other areas, e.g. making ui.horizontal smarter by looking at last frames intrinsic size and improving egui_flex support for add_ui

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Experiment with using cross_intrinsic_size bookkeeping in Placer
1 participant