Use PhysicalPosition in PixelDelta event
This removes the `LogicalPosition` from the `PixelDelta`, since all other APIs have been switched to use `PhysicalPosition` instead. Fixes #1406.
This commit is contained in:
parent
55dff53a98
commit
40232d48ba
6 changed files with 31 additions and 19 deletions
|
|
@ -999,10 +999,14 @@ extern "C" fn scroll_wheel(this: &Object, _sel: Sel, event: id) {
|
|||
mouse_motion(this, event);
|
||||
|
||||
unsafe {
|
||||
let state_ptr: *mut c_void = *this.get_ivar("winitState");
|
||||
let state = &mut *(state_ptr as *mut ViewState);
|
||||
|
||||
let delta = {
|
||||
let (x, y) = (event.scrollingDeltaX(), event.scrollingDeltaY());
|
||||
if event.hasPreciseScrollingDeltas() == YES {
|
||||
MouseScrollDelta::PixelDelta((x as f64, y as f64).into())
|
||||
let delta = LogicalPosition::new(x, y).to_physical(state.get_scale_factor());
|
||||
MouseScrollDelta::PixelDelta(delta)
|
||||
} else {
|
||||
MouseScrollDelta::LineDelta(x as f32, y as f32)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue