aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/cocoa/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/cocoa/mod.rs')
-rw-r--r--src/api/cocoa/mod.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs
index 511148b..877aba7 100644
--- a/src/api/cocoa/mod.rs
+++ b/src/api/cocoa/mod.rs
@@ -275,7 +275,15 @@ impl<'a> Iterator for PollEventsIterator<'a> {
self.window.delegate.state.pending_events.lock().unwrap().extend(events.into_iter());
event
},
- NSScrollWheel => { Some(MouseWheel(event.scrollingDeltaX() as f64, event.scrollingDeltaY() as f64)) },
+ NSScrollWheel => {
+ use events::MouseScrollDelta::{LineDelta, PixelDelta};
+ let delta = if event.hasPreciseScrollingDeltas() == YES {
+ PixelDelta(event.scrollingDeltaX() as f32, event.scrollingDeltaY() as f32)
+ } else {
+ LineDelta(event.scrollingDeltaX() as f32, event.scrollingDeltaY() as f32)
+ };
+ Some(MouseWheel(delta))
+ },
_ => { None },
};