Skip to content

Commit

Permalink
Physical viewport calculation fix (#5055)
Browse files Browse the repository at this point in the history
# Objective

- Fixes early return when viewport is not set. This now matches the description of the function.

## Solution

- Remove errant try `?`.
  • Loading branch information
aevyrie committed Jun 20, 2022
1 parent 8e8cbcc commit 9095d2f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/bevy_render/src/camera/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ impl Camera {
/// the full physical rect of the current [`RenderTarget`].
#[inline]
pub fn physical_viewport_rect(&self) -> Option<(UVec2, UVec2)> {
let min = self.viewport.as_ref()?.physical_position;
let min = self
.viewport
.as_ref()
.map(|v| v.physical_position)
.unwrap_or(UVec2::ZERO);
let max = min + self.physical_viewport_size()?;
Some((min, max))
}
Expand Down

0 comments on commit 9095d2f

Please sign in to comment.