Skip to content

Add and cleanup new leaf-nodes methods#181

Merged
alice-i-cecile merged 4 commits intoDioxusLabs:mainfrom
Weibye:rename-method
Jun 19, 2022
Merged

Add and cleanup new leaf-nodes methods#181
alice-i-cecile merged 4 commits intoDioxusLabs:mainfrom
Weibye:rename-method

Conversation

@Weibye
Copy link
Copy Markdown
Collaborator

@Weibye Weibye commented Jun 19, 2022

Objective

@Weibye Weibye requested a review from TimJentzsch June 19, 2022 14:59
@Weibye Weibye added usability Make the library more comfortable to use breaking-change A change that breaks our public interface labels Jun 19, 2022
@alice-i-cecile
Copy link
Copy Markdown
Collaborator

The breaking change needs a note in RELEASES.md.

@Weibye
Copy link
Copy Markdown
Collaborator Author

Weibye commented Jun 19, 2022

Copy link
Copy Markdown
Collaborator

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a much more sensible API!

We should change all of the style argument names to layout while we're here.

let mut taffy = Taffy::new();
let node = taffy
.new_leaf(FlexboxLayout::default(), MeasureFunc::Raw(|_| Size { width: 200.0, height: 200.0 }))
.new_leaf_with_measure(FlexboxLayout::default(), MeasureFunc::Raw(|_| Size { width: 200.0, height: 200.0 }))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be migrated to the new method.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would anything with MeasureFunc::Raw(|_| .. ) be a candidate for migration? If the measure func constraints are discarded, it would make sense that it's not used?

Copy link
Copy Markdown
Collaborator Author

@Weibye Weibye Jun 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was this, then two other occurrences of this; however those were specifically testing the MeasureFunc so migrating those does not make sense.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: This test is specifically testing the behaviour of first setting one MeasureFunc, then setting a different, hence this should not be changed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, sounds good.

@alice-i-cecile
Copy link
Copy Markdown
Collaborator

It is, unless you want me to rephrase it more "loudly"?

My bad; I'd glossed over this.

@Weibye
Copy link
Copy Markdown
Collaborator Author

Weibye commented Jun 19, 2022

It is, unless you want me to rephrase it more "loudly"?

My bad; I'd glossed over this.

It is a bit of a sneaky change, as the method exists (in the new form) though compiler will complain that you are trying to supply too many arguments. Is the RELEASES good as is or should we add a note that is a bit more clear on this?

Copy link
Copy Markdown
Collaborator

@TimJentzsch TimJentzsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this, much better than just always providing an empty slice.

In the future I'd really like some kind of building pattern to set the styles and everything, but that could also be done directly on the layout instead of the node itself.

@alice-i-cecile
Copy link
Copy Markdown
Collaborator

It is a bit of a sneaky change, as the method exists (in the new form) though compiler will complain that you are trying to supply too many arguments. Is the RELEASES good as is or should we add a note that is a bit more clear on this?

I'm happy with this; the problem was that the Github UI misled my eye since I didn't see RELEASES.md in any of the folders 😅

@alice-i-cecile alice-i-cecile enabled auto-merge (squash) June 19, 2022 15:19
@alice-i-cecile alice-i-cecile merged commit 943cd89 into DioxusLabs:main Jun 19, 2022
@Weibye Weibye deleted the rename-method branch June 19, 2022 16:03
jkelleyrtp pushed a commit that referenced this pull request Oct 10, 2022
* Rename and add method

* formatting

* Migrate test to use new method

* Rename arguments `style` -> `layout`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change A change that breaks our public interface usability Make the library more comfortable to use

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Taffy::new_node() method to add new node without children

3 participants