mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 14:51:30 +11:00
Report scroll deltas in lines for non-touch devices on OS X
Scroll deltas on OS X may be reported either as pixel deltas to scroll by if supported by the device or line/row deltas otherwise.
This commit is contained in:
parent
5e626b7fdf
commit
5b08220df5
|
@ -276,8 +276,12 @@ impl<'a> Iterator for PollEventsIterator<'a> {
|
||||||
event
|
event
|
||||||
},
|
},
|
||||||
NSScrollWheel => {
|
NSScrollWheel => {
|
||||||
use events::MouseScrollDelta::PixelDelta;
|
use events::MouseScrollDelta::{LineDelta, PixelDelta};
|
||||||
let delta = PixelDelta(event.scrollingDeltaX() as f32, event.scrollingDeltaY() as f32);
|
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))
|
Some(MouseWheel(delta))
|
||||||
},
|
},
|
||||||
_ => { None },
|
_ => { None },
|
||||||
|
|
Loading…
Reference in a new issue