Skip to content

Commit

Permalink
Improve logical_viewport_size.
Browse files Browse the repository at this point in the history
  • Loading branch information
tormeh committed Sep 18, 2023
1 parent f0196cc commit e47769b
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions crates/bevy_render/src/camera/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,15 @@ impl Camera {
#[inline]
pub fn logical_viewport_size(&self) -> Result<Vec2, LogicalViewportSizeError> {
let viewport = self.viewport.as_ref();
let logical_viewport_size = viewport.and_then(|v| self.to_logical(v.physical_size));
if let Some(size) = logical_viewport_size {
if let Some(size) = viewport.and_then(|v| self.to_logical(v.physical_size)) {
Ok(size)
} else if let Some(size) = self.logical_target_size() {
Ok(size)
} else {
let logical_target_size = self.logical_target_size();
if let Some(size) = logical_target_size {
Ok(size)
} else {
Err(LogicalViewportSizeError {
viewport_is_set: viewport.is_some(),
target_info_is_set: self.computed.target_info.is_some(),
})
}
Err(LogicalViewportSizeError {
viewport_is_set: viewport.is_some(),
target_info_is_set: self.computed.target_info.is_some(),
})
}
}

Expand Down

0 comments on commit e47769b

Please sign in to comment.