mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 23:01:30 +11:00
Merge pull request #718 from paulrouget/hidpiwheel
osx: scroll delta should take hidpi factor into account
This commit is contained in:
commit
b63070db25
|
@ -881,10 +881,13 @@ unsafe fn NSEventToEvent(window: &Window, nsevent: id) -> Option<Event> {
|
||||||
},
|
},
|
||||||
NSScrollWheel => {
|
NSScrollWheel => {
|
||||||
use events::MouseScrollDelta::{LineDelta, PixelDelta};
|
use events::MouseScrollDelta::{LineDelta, PixelDelta};
|
||||||
|
let scale_factor = window.hidpi_factor();
|
||||||
let delta = if nsevent.hasPreciseScrollingDeltas() == YES {
|
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 {
|
} 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))
|
Some(MouseWheel(delta))
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue