Skip to content

Commit

Permalink
Physical viewport calculation fix (bevyengine#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 authored and james7132 committed Jun 22, 2022
1 parent 9a8e5fd commit 03ffbe8
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 03ffbe8

Please sign in to comment.