diff options
author | tomaka <pierre.krieger1708@gmail.com> | 2016-02-02 10:53:11 +0100 |
---|---|---|
committer | tomaka <pierre.krieger1708@gmail.com> | 2016-02-02 10:53:11 +0100 |
commit | b63070db25173826c669551514acdefe76a15885 (patch) | |
tree | 8a760e7b8103576bd289257bce86e257e86d1bb4 /src/api | |
parent | 5288b7dfc63179549ef579c29a477b43ea409218 (diff) | |
parent | 99073eec7b1549ead1a62b67e205a80d02053dba (diff) | |
download | glutin-b63070db25173826c669551514acdefe76a15885.tar.gz glutin-b63070db25173826c669551514acdefe76a15885.zip |
Merge pull request #718 from paulrouget/hidpiwheel
osx: scroll delta should take hidpi factor into account
Diffstat (limited to 'src/api')
-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)) }, |