diff --git a/CHANGELOG.md b/CHANGELOG.md index 2eb312ca..3658c23d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ - On NetBSD, fixed crash due to incorrect detection of the main thread. - **Breaking:** The virtual key code `Subtract` has been renamed to `NumpadSubtract` - **Breaking:** On X11, `-` key is mapped to the `Minus` virtual key code, instead of `Subtract` +- On macOS, fix inverted horizontal scroll. # 0.22.2 (2020-05-16) diff --git a/src/platform_impl/macos/view.rs b/src/platform_impl/macos/view.rs index 35751500..2c379e0a 100644 --- a/src/platform_impl/macos/view.rs +++ b/src/platform_impl/macos/view.rs @@ -1003,7 +1003,8 @@ extern "C" fn scroll_wheel(this: &Object, _sel: Sel, event: id) { let state = &mut *(state_ptr as *mut ViewState); let delta = { - let (x, y) = (event.scrollingDeltaX(), event.scrollingDeltaY()); + // macOS horizontal sign convention is the inverse of winit. + let (x, y) = (event.scrollingDeltaX() * -1.0, event.scrollingDeltaY()); if event.hasPreciseScrollingDeltas() == YES { let delta = LogicalPosition::new(x, y).to_physical(state.get_scale_factor()); MouseScrollDelta::PixelDelta(delta)