mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-07-08 18:29:43 +00:00
cocoa: restore discrete mouse wheel ticks
(cherry picked from commit 1f3f714393)
This commit is contained in:
committed by
Ryan C. Gordon
parent
b18591f4a0
commit
27e6b7a119
@@ -618,17 +618,18 @@ void Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event)
|
||||
SDL_MouseWheelDirection direction;
|
||||
CGFloat x, y;
|
||||
|
||||
x = -[event deltaX];
|
||||
y = [event deltaY];
|
||||
direction = SDL_MOUSEWHEEL_NORMAL;
|
||||
|
||||
if ([event isDirectionInvertedFromDevice] == YES) {
|
||||
direction = SDL_MOUSEWHEEL_FLIPPED;
|
||||
}
|
||||
|
||||
/* For discrete scroll events from conventional mice, always send a full tick.
|
||||
For continuous scroll events from trackpads, send fractional deltas for smoother scrolling. */
|
||||
if (![event hasPreciseScrollingDeltas]) {
|
||||
if ([event hasPreciseScrollingDeltas]) {
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user