Closed Frosty-J closed 8 months ago
See, it can be 0 as well (interestingly, positive 0 instead of negative 0 when on LWJGL2). "Positive or negative" could lead someone to believe the following code is safe, when it would inadvertently report as scrolling up if the user scrolls horizontally (with touchpad, not sure how else):
if (amountY > 0) Gdx.app.log("scroll", "down");
else Gdx.app.log("scroll", "up");
I'm overthinking this, to be fair. Never had a reason to perform that sort of condition check, just stuff like scrollY += amountY
.
Changed in 13a5e9c.
I can't think of the good words at the mo...
...but this is not entirely correct. Pre-1.9.12, yeah, good enough. It would only not be -1 or 1 if the user managed to scroll two or more clicks in one frame.
But since then, either axis can be 0 (X if the user is scrolling Y, or vice-versa) and fractional amounts (on my touchpad I get 0.016666668, 0.025, 0.033333335...). In my testing, if you scroll diagonally, it will alternate between X and Y (or Y and X - it's hard to tell).
https://libgdx.com/wiki/input/event-handling