From 99073eec7b1549ead1a62b67e205a80d02053dba Mon Sep 17 00:00:00 2001 From: Paul Rouget Date: Tue, 2 Feb 2016 10:25:26 +0100 Subject: osx: scroll delta should take hidpi factor into account --- src/api/cocoa/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') 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 { }, 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)) }, -- cgit v1.2.3