-
-
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
Changed (Vec2, Vec2) to Rect in Camera::logical_viewport_rect #7867
Changed (Vec2, Vec2) to Rect in Camera::logical_viewport_rect #7867
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
Could you also change |
I had a look at that but since there's no |
Seems like a good case for a |
@s-lambert CI seems to be failing to detect the right settings. Can you please rebase your PR or merge main into your branch? |
Done 👍, rebased on latest main. |
…ect (#9085) # Objective Continue #7867 now that we have URect #7984 - Return `URect` instead of `(UVec2, UVec2)` in `Camera::physical_viewport_rect` - Add `URect` and `IRect` to prelude ## Changelog - Changed `Camera::physical_viewport_rect` return type from `(UVec2, UVec2)` to `URect` - `URect` and `IRect` were added to prelude ## Migration Guide Before: ```rust fn view_physical_camera_rect(camera_query: Query<&Camera>) { let camera = camera_query.single(); let Some((min, max)) = camera.physical_viewport_rect() else { return }; dbg!(min, max); } ``` After: ```rust fn view_physical_camera_rect(camera_query: Query<&Camera>) { let camera = camera_query.single(); let Some(URect { min, max }) = camera.physical_viewport_rect() else { return }; dbg!(min, max); } ```
Objective
Camera::logical_viewport_rect()
returnsOption<(Vec2, Vec2)>
which is a tuple of vectors representing the(min, max)
bounds of the viewport rect. Since the function says it returns a rect and there is aRect { min, max }
struct inbevy_math
, using the struct will be clearer.Solution
Replaced
Option<(Vec2, Vec2)>
withOption<Rect>
forCamera::logical_viewport_rect()
.Changelog
Camera::logical_viewport_rect
return type from(Vec2, Vec2)
toRect
Migration Guide
Before:
After: