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:
Christian Duerr 2020-07-26 22:16:21 +00:00 committed by GitHub
parent 55dff53a98
commit 40232d48ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 19 deletions

View file

@ -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)
}