-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Add common aspect ratio constants and improve documentation #15091
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
Conversation
bf4bd87 to
21a52f2
Compare
- Add new constants for common aspect ratios: SIXTEEN_NINE, FOUR_THREE, ULTRAWIDE - Enhance module-level documentation with overview and use cases - Expand explanation of AspectRatio struct with examples - Provide detailed descriptions and examples for all methods (existing and new) - Add explanations for the newly introduced constant values - Include clarifications for From trait implementations This commit introduces convenient constants for frequently used aspect ratios and significantly improves the overall documentation, enhancing the usability and understanding of the AspectRatio API.
Co-authored-by: Gonçalo Rica Pais da Silva <bluefinger@gmail.com>
Co-authored-by: Lixou <82600264+DasLixou@users.noreply.github.com>
| /// An `AspectRatio` is the ratio of width to height. | ||
| #[derive(Copy, Clone, Debug, PartialEq, PartialOrd)] | ||
| #[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] | ||
| pub struct AspectRatio(f32); |
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 think we're missing a getter for the internal field here. You can call .into, but that's pretty obscure.
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 the getter be named as_f32 or ratio?
I'm thinking about 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.
In my opinion, ratio is more appropriate.
alice-i-cecile
left a comment
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 really like the thrust of this: helpful error types are excellent, and I like the utility methods you've added. I have a few relatively minor requests.
|
There's some potential overlap with #14158, FYI |
|
Is there anything else we should do to avoid overlap with issue #14158 ? |
Hello,
I'd like to contribute to this project by adding some useful constants and improving the documentation for the AspectRatio struct. Here's a summary of the changes I've made:
Added new constants for common aspect ratios:
Enhanced the overall documentation:
These changes aim to make the AspectRatio API more user-friendly and easier to understand. The new constants provide convenient access to commonly used aspect ratios, which I believe will be helpful in many scenarios.