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

BorderRect maintenance #16727

Merged
merged 6 commits into from
Dec 12, 2024

Conversation

ickshonpe
Copy link
Contributor

@ickshonpe ickshonpe commented Dec 9, 2024

Objective

The doc comments and function namings for BorderRect feel imprecise to me. Particularly the square function which is used to define a uniform BorderRect with equal widths on each edge. But this is potentially confusing since this "square" border could be around an oblong shape.

Using "padding" to refer to the border extents seems undesirable too since "padding" is typically used to refer to the area between border and content, not the border itself.

Solution

  • Rename square to all (this matches the name of the similar method on UiRect).
  • Rename rectangle to axes (this matches the name of the similar method on UiRect).
  • Update doc comments.

Migration Guide

The square and rectangle functions belonging to BorderRect have been renamed to all and axes.

* Renamed `square` to `all`.
* Renamed `rectangle` to `axes`.
* Renamed `value` to `extent`.
* Updated the doc comments.
@ickshonpe ickshonpe added A-UI Graphical user interfaces, styles, layouts, and widgets C-Docs An addition or correction to our documentation C-Code-Quality A section of code that is hard to understand or change S-Needs-Review Needs reviewer attention (from anyone!) to move forward A-Rendering Drawing game state to the screen and removed A-UI Graphical user interfaces, styles, layouts, and widgets labels Dec 9, 2024
#[derive(Default, Copy, Clone, PartialEq, Debug, Reflect)]
pub struct BorderRect {
/// Pixel padding to the left
Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I know, this was the only hint in docs in anything related to texture slicing about the values being in pixels. So it would be great to get that information back somewhere.

Copy link
Contributor Author

@ickshonpe ickshonpe Dec 9, 2024

Choose a reason for hiding this comment

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

Yep I'll add something to the TextureSlicer docs I think. BorderRect is used in different coordinate spaces so it doesn't make sense to refer to pixels here.

@alice-i-cecile alice-i-cecile added the M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide label Dec 10, 2024
@alice-i-cecile
Copy link
Member

I like these changes, but seconding the request not to lose the information about pixels :)

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Dec 11, 2024
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Dec 11, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 11, 2024
@alice-i-cecile
Copy link
Member

CI failure seems real and related: I think there's a conditional compilation issue here.

@rparrett
Copy link
Contributor

I think it's just new stuff from #16693 that needs to be updated.

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Dec 12, 2024
Merged via the queue into bevyengine:main with commit f4800c2 Dec 12, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen A-UI Graphical user interfaces, styles, layouts, and widgets C-Code-Quality A section of code that is hard to understand or change C-Docs An addition or correction to our documentation M-Needs-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants