Inline redundant function

This commit is contained in:
Hanno Braun 2025-03-25 20:58:57 +01:00
parent f789c09ef7
commit 28a4428c88
2 changed files with 4 additions and 6 deletions

View File

@ -100,7 +100,10 @@ impl ViewerWindow {
/// # Handle a cursor movement
pub fn on_cursor_movement(&mut self, [x, y]: [f64; 2]) {
let [width, height] = self.window.size().as_f64();
let [width, height]: [f64; 2] = {
let size = self.window.size();
[size.width, size.height].map(Into::into)
};
let aspect_ratio = width / height;
// Cursor position in normalized coordinates (-1 to +1) with aspect

View File

@ -47,9 +47,4 @@ impl WindowSize {
pub fn is_valid(&self) -> bool {
self.width > 0 && self.height > 0
}
/// Convert size to `f64`
pub fn as_f64(&self) -> [f64; 2] {
[self.width, self.height].map(Into::into)
}
}