Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
aevyrie committed Jun 6, 2022
1 parent f486d57 commit f45bb7d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions crates/bevy_render/src/camera/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,8 @@ impl Camera {
/// Converts a physical size in this `Camera` to a logical size.
#[inline]
pub fn physical_to_logical(&self, input: UVec2) -> Option<Vec2> {
self.computed.target_info.as_ref().map(|target_info| {
Vec2::new(
(input.x as f64 / target_info.scale_factor) as f32,
(input.y as f64 / target_info.scale_factor) as f32,
)
})
let scale = self.computed.target_info.as_ref()?.scale_factor;
Some((input.as_dvec2() / scale).as_vec2())
}

/// The logical dimensions of the viewport, the (minimum, maximum) points of the viewport,
Expand Down

0 comments on commit f45bb7d

Please sign in to comment.