Skip to content

Commit

Permalink
Ignore x-axis only mouse wheel events
Browse files Browse the repository at this point in the history
Some mice (like mine) have an x and y axis on the wheel.

Ignore mouse wheel events that are x-axis only (so therefore have a y-axis value of zero).  The behavior of my (Microsoft) mouse is that pushing left and right on the wheel repeatedly call mouse wheel y events as long as it's held.  We were interpreting these as always being mouse wheel down events, causing my clumsy fingers on the mouse wheel to zoom very quickly out in the third person ship view, sector view and so forth.
  • Loading branch information
JonBooth78 committed Sep 9, 2023
1 parent 10e04ca commit f11ec15
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,10 @@ void Manager::HandleSDLEvent(SDL_Event &event)
}
break;
case SDL_MOUSEWHEEL:
mouseWheel = event.wheel.y;
onMouseWheel.emit(event.wheel.y > 0); // true = up
if (event.wheel.y != 0) {
mouseWheel = event.wheel.y;
onMouseWheel.emit(event.wheel.y > 0); // true = up
}
break;
case SDL_MOUSEMOTION:
mouseMotion[0] += event.motion.xrel;
Expand Down

0 comments on commit f11ec15

Please sign in to comment.