Fix winit transformed input

This commit is contained in:
Drakulix 2018-03-09 11:32:54 +01:00
parent bdb653042c
commit a6d8b2a802
1 changed files with 12 additions and 18 deletions

View File

@ -360,27 +360,21 @@ impl PointerMotionAbsoluteEvent for WinitMouseMovedEvent {
} }
fn x_transformed(&self, width: u32) -> u32 { fn x_transformed(&self, width: u32) -> u32 {
cmp::min( (self.x * width as f64
(self.x * width as f64 / self.window
/ self.window .window()
.window() .get_inner_size()
.get_inner_size() .unwrap_or((width, 0))
.unwrap_or((width, 0)) .0 as f64) as u32
.0 as f64) as u32,
0,
)
} }
fn y_transformed(&self, height: u32) -> u32 { fn y_transformed(&self, height: u32) -> u32 {
cmp::min( (self.y * height as f64
(self.y * height as f64 / self.window
/ self.window .window()
.window() .get_inner_size()
.get_inner_size() .unwrap_or((0, height))
.unwrap_or((0, height)) .1 as f64) as u32
.1 as f64) as u32,
0,
)
} }
} }