mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 22:31:30 +11:00
osx: scroll delta should take hidpi factor into account
This commit is contained in:
parent
5288b7dfc6
commit
99073eec7b
|
@ -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))
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue