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

Replace BoxConstraints and update Layout function #701

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jaredoconnell
Copy link
Contributor

This pull request works towards implementing changes proposed in #37

It does so by replacing BoxConstraints with a generic type that has a vertical and horizontal component. The Layout function has the BoxConstraints parameter replaced with available_space and requested_fill. available_space is like the Size type; it uses the new generic type with f64 as the type on the axes. requested_fill takes the place of the min size in BoxConstraints, and will have more future uses with Intrinsic sizing. When set to Exact, the widgets should behave the way they did when they previously got BoxConstraints with the min equaling the max. I did not find any instances where min wasn't set to either 0 by 0 or the max.

I chose BiAxial for the name for the generic 2D type that is used for the layout parameters. I think it is descriptive while not colliding with the names of other types. Size was proposed in #37, but it collided with the Size type in several libraries, including Kurbo. And for the uses that were proposed, including requested_fill, I felt like a more generic name made sense. If the community doesn't like the name, I'm open to changing it.

This code is ready for high-level review, including discussions on whether or not this is the way forward, as well as naming and file structure.

This design is a major step forward towards implementing Taffy integration.
The code still has at least one bug (like in the Flex example). I need to fix the linter errors, validate the tests, and fix the ordering of the code in the new files. But the examples should work mostly.

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.

1 participant