diff options
author | Paul Rouget <me@paulrouget.com> | 2016-02-02 10:25:26 +0100 |
---|---|---|
committer | Paul Rouget <me@paulrouget.com> | 2016-02-02 10:25:26 +0100 |
commit | 99073eec7b1549ead1a62b67e205a80d02053dba (patch) | |
tree | 8a760e7b8103576bd289257bce86e257e86d1bb4 /src/api/cocoa | |
parent | 5288b7dfc63179549ef579c29a477b43ea409218 (diff) | |
download | glutin-99073eec7b1549ead1a62b67e205a80d02053dba.tar.gz glutin-99073eec7b1549ead1a62b67e205a80d02053dba.zip |
osx: scroll delta should take hidpi factor into account
Diffstat (limited to 'src/api/cocoa')
-rw-r--r-- | src/api/cocoa/mod.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs index 138a448..66244d8 100644 --- a/src/api/cocoa/mod.rs +++ b/src/api/cocoa/mod.rs @@ -881,10 +881,13 @@ unsafe fn NSEventToEvent(window: &Window, nsevent: id) -> Option<Event> { }, NSScrollWheel => { use events::MouseScrollDelta::{LineDelta, PixelDelta}; + let scale_factor = window.hidpi_factor(); let delta = if nsevent.hasPreciseScrollingDeltas() == YES { - PixelDelta(nsevent.scrollingDeltaX() as f32, nsevent.scrollingDeltaY() as f32) + PixelDelta(scale_factor * nsevent.scrollingDeltaX() as f32, + scale_factor * nsevent.scrollingDeltaY() as f32) } else { - LineDelta(nsevent.scrollingDeltaX() as f32, nsevent.scrollingDeltaY() as f32) + LineDelta(scale_factor * nsevent.scrollingDeltaX() as f32, + scale_factor * nsevent.scrollingDeltaY() as f32) }; Some(MouseWheel(delta)) }, |