-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Change the default for the measure_func
field of ContentSize
to None.
#9346
Change the default for the measure_func
field of ContentSize
to None.
#9346
Conversation
ContentSize
's measure_func
field to None.measure_func
field of ContentSize
to None.
It looks like your PR is a breaking change, but you didn't provide a migration guide. Could you add some context on what users should update when this change get released in a new version of Bevy? |
@ickshonpe ping on the migration guide, but I'll merge this tomorrow regardless. |
* Added a `fixed_size` helper function that creates a new `ContentSize` with a `Measure` that always returns the same value, regardless of the UI layout's contraints.
Migration guide fixed and added a little helper function. Should be all ready. |
The helper function is a great idea :) |
Objective
The default for
ContentSize
should have themeasure_func
field set toNone
, instead of a fixed size of zero. This means that until a measure func is set the size of the UI node will be determined by itsStyle
constraints. This is preferable as it allows users to specify the space the Node should take up in the layout while waiting for content to load.Solution
Derive
Default
forContentSize
.The PR also adds a
fixed_size
helper function to make it a bit easier to access the old behaviour.Changelog
Default
forContentSize
fixed_size
helper function toContentSize
that creates a newContentSize
with aMeasureFunc
that always returns the same value, regardless of layout constraints.Migration Guide
The default for
ContentSize
now sets itsmeasure_func
toNone
, instead of a fixed size measure that returnsVec2::ZERO
.The helper function
fixed_size
can be called withContentSize::fixed_size(Vec2::ZERO)
to get the previous behaviour.