mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-07-09 18:59:55 +00:00
cocoa: restore discrete mouse wheel ticks
This commit is contained in:
committed by
Ryan C. Gordon
parent
7afd6c3497
commit
1f3f714393
@@ -918,8 +918,6 @@ void Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event)
|
||||
SDL_MouseWheelDirection direction;
|
||||
CGFloat x, y;
|
||||
|
||||
x = -[event scrollingDeltaX];
|
||||
y = [event scrollingDeltaY];
|
||||
direction = SDL_MOUSEWHEEL_NORMAL;
|
||||
|
||||
if ([event isDirectionInvertedFromDevice] == YES) {
|
||||
@@ -927,8 +925,21 @@ void Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event)
|
||||
}
|
||||
|
||||
if ([event hasPreciseScrollingDeltas]) {
|
||||
x *= 0.1;
|
||||
y *= 0.1;
|
||||
x = -[event scrollingDeltaX] * 0.1f;
|
||||
y = [event scrollingDeltaY] * 0.1f;
|
||||
} else {
|
||||
x = -[event deltaX];
|
||||
y = [event deltaY];
|
||||
if (x > 0) {
|
||||
x = SDL_ceil(x);
|
||||
} else if (x < 0) {
|
||||
x = SDL_floor(x);
|
||||
}
|
||||
if (y > 0) {
|
||||
y = SDL_ceil(y);
|
||||
} else if (y < 0) {
|
||||
y = SDL_floor(y);
|
||||
}
|
||||
}
|
||||
|
||||
SDL_SendMouseWheel(Cocoa_GetEventTimestamp([event timestamp]), window, mouseID, x, y, direction);
|
||||
|
||||
Reference in New Issue
Block a user