Conversation
Zarenor
left a comment
There was a problem hiding this comment.
Here's a review of this PR; once we've talked through these suggestions, I'll be happy to review again and approve for merging. I'm excited to have this functionality.
I do wonder - is 'max' redundant in the function names? As we've defined it, the intrinsic width is width a widget wishes to be if it has no width constraint - max or min, given the height constraint it has, and vice-versa for height... I'm not sure it's a maximum or a minimum?
|
@Zarenor I agree with your naming suggestions. Actually, anything than what I have makes sense. Im horrible at naming. |
|
I forgot to address this point
|
Zarenor
left a comment
There was a problem hiding this comment.
Looks good to me! Excited to have this feature implemented.
xStrom
left a comment
There was a problem hiding this comment.
I did a quick review for some polish. I didn't really do deep analysis of the algorithms though.
Most of my comments are about use import ordering. Sorry about that. I would love to have this automated in the future. There has been a rustfmt proposal for this since 2018 but nobody has invested the time to get it fully done yet. There does seem to be some progress in that rustfmt now has a group_imports option, but it's still unstable. I'll see if we can have a better solution to this, or at least some sort of style guide document. But yeah, for now just remember that the general grouping/ordering of imports should be:
use std::foo;
use some_extrnal_crate::foo;
use crate::my_foo;|
Please also add a changelog entry. |
|
I'll also add for the record, that for me personally So I don't think this is a blocker to get this merged. We can bikeshed over the name later, perhaps as part of the Xilem API rework. |
xStrom
left a comment
There was a problem hiding this comment.
Thanks for your continued effort to get this in!
This PR adds
compute_max_intrinsicfunction toWidgettrait. Along with the usuallayoutparams, this method also takes anAxisparam that controls which intrinsic is expected.Axis::Horizontal= Max width intrinsic is expected.Axis::Vertical= Max height intrinsic is expected.Each widget gets to decide what its intrinsic max width/height is.
For some non-container widgets like
Labelit is the width the label would take without any line breaks.For container widget like
AspectRatioBoxit depends on its width/height irrespective of child's intrinsic width/height. Child's intrinsic is calculated only ifAspectRatioBoxwidth/height is infinite.There are sometodos Im planning to fix before I mark this ready for review. But I wanted to get other main points across with this draft PR.Addressed all
todos.