Express scroll deltas as either line or pixel deltas
Depending on the platform and device, scroll deltas may either be represented as pixel deltas specifying the amount in pixels to scroll or they may be expressed in 'lines' or 'chunks' for low resolution devices (eg. a traditional mouse wheel). Pixel deltas are currently available on OS X. X11 currently supports only integer line deltas, though pixel deltas are available via XInput2. Windows supports fractional line deltas.
This commit is contained in:
parent
a0e29d9410
commit
f0bab95c4d
5 changed files with 33 additions and 8 deletions
|
|
@ -275,7 +275,11 @@ 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::PixelDelta;
|
||||
let delta = PixelDelta(event.scrollingDeltaX() as f32, event.scrollingDeltaY() as f32);
|
||||
Some(MouseWheel(delta))
|
||||
},
|
||||
_ => { None },
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue