Merge pull request #336 from Veedrac/hidpi_fix

Fix non-integer HiDPI support in demo
This commit is contained in:
Patrick Walton 2020-05-11 11:19:06 -07:00 committed by GitHub
commit cbceee85e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -461,7 +461,7 @@ impl<W> DemoApp<W> where W: Window {
}
fn process_mouse_position(&mut self, new_position: Vector2I) -> MousePosition {
let absolute = new_position * self.window_size.backing_scale_factor as i32;
let absolute = (new_position.to_f32() * self.window_size.backing_scale_factor).to_i32();
let relative = absolute - self.last_mouse_position;
self.last_mouse_position = absolute;
MousePosition { absolute, relative }