-
-
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
Update taffy requirement from 0.3.10 to 0.4.0 #12298
Conversation
Updates the requirements on [taffy](https://github.com/DioxusLabs/taffy) to permit the latest version. - [Release notes](https://github.com/DioxusLabs/taffy/releases) - [Changelog](https://github.com/DioxusLabs/taffy/blob/main/RELEASES.md) - [Commits](DioxusLabs/taffy@v0.3.10...v0.4.0) --- updated-dependencies: - dependency-name: taffy dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]>
@@ -133,6 +134,7 @@ pub fn from_style(context: &LayoutContext, style: &Style) -> taffy::style::Style | |||
.collect::<Vec<_>>(), | |||
grid_row: style.grid_row.into(), | |||
grid_column: style.grid_column.into(), | |||
..default() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some new overflow
and scrollbar_width
properties. Should they be replicated on bevy_ui::Style
and if so, should that be done in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please to both.
} | ||
|
||
type UiTaffyTree = TaffyTree<Box<dyn Measure>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that the measurement/node context type is user-defined, should we use a enum with one variant for each of FixedMeasure
, ImageMeasure
... internal to bevy_ui
plus a Box<dyn Measure>
variant, to avoid doing dynamic dispatch for most use cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
available_space.height, | ||
) | ||
}) | ||
.unwrap_or(Vec2::ZERO); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should layouting an empty leaf node with no size log a warning/error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like a warn_once!
for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say probably not. Such a node could get it's size from it's parent (e.g. by stretch alignment in a flexbox stack or to a grid cell)
Will do a proper review later, but note that I also have a PR for this: #10690 The only thing blocking that PR is:
This is required because Taffy 0.4 reserves space for padding/borders on leaf nodes but currently the content (text, image, etc) is still rendering at the top-left corner of the larger box rather than being offset by the border and padding widths. |
Closing in favor of this one since it seems a straight upgrade over the changes I did here. |
Objective
Solution
needs_measure
since it has been removed.LayoutTree
trait with the corresponding traits it has been split into.MeasureFunc
with aBox<dyn<Measure>>
as a node context, equivalent toMeasureFunc::Boxed
.Changelog
Changed
0.4.0
. If you are directly using taffy types re-exported frombevy_ui
, you may need to change some import paths. (see the corresponding release notes)UiSurface::try_update_measure
takes aBox<dyn Measure>
instead of the now removed taffyMeasureFunc
.Migration Guide
UiSurface::try_update_measure
, you should implement the bevy providedMeasure
trait on your measurement struct instead of using the removedMeasureFunc::Boxed
with the similar taffy providedMeasurable
trait.