Skip to content

Commit cbceee8

Browse files
authored
Merge pull request rust-windowing#336 from Veedrac/hidpi_fix
Fix non-integer HiDPI support in demo
2 parents 5ed2681 + faea46b commit cbceee8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

demo/common/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ impl<W> DemoApp<W> where W: Window {
461461
}
462462

463463
fn process_mouse_position(&mut self, new_position: Vector2I) -> MousePosition {
464-
let absolute = new_position * self.window_size.backing_scale_factor as i32;
464+
let absolute = (new_position.to_f32() * self.window_size.backing_scale_factor).to_i32();
465465
let relative = absolute - self.last_mouse_position;
466466
self.last_mouse_position = absolute;
467467
MousePosition { absolute, relative }

0 commit comments

Comments
 (0)