New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Scene2d.ui] Adding support for horizontal scrolling (touch pad and touch screen) #6154
Conversation
Instead of |
Agreed, floatToIntBits is a bit better since it preserves the entire float. Otherwise it looks good to me. |
68638a6
to
804f49d
Compare
Please correct the tests, they don't compile any more. |
I have a problem with this. Changing InputListener and InputAdapter by removing the old |
@jpauty let's add a new |
804f49d
to
da392dd
Compare
I've added the scrolled method for backward compatibility. I've also replaced my retro fixed point conversion to calls to NumberUtils. The travis checks passes. Sorry for the compile errors. I'm only using mvn to check compilation, which apparently skips the tests. I tried briefly with gradle, but it requires android, which I don't have time to setup right now. |
Which command are you using? |
mvn install |
That should not skip tests: weird. Maybe it's because the libGDX project structure isn't the same as the default Maven one, and thus the tests aren't hooked up properly to the maven command? Also, it's recommended to clean too: |
The tests which failed were not automated tests. It's the test project which is not included inside the maven environment because they don't have to get deployed |
Every implementor of InputProcessor is going to be 'broken' no matter what - whether we keep the old scrolled method or not, right? After all, they will need to implement the new method. I'm not sure about the change in InputAdapter calling into the old scrolled method by default - this feels like asking for trouble. If we're going to break it, we might as well just break it once and leave it in the state we want. Leaving a method that we don't really want and which only gets called via a compatibility layer (InputAdapter) isn't really doing anyone any favors. When we eventually do remove it, we'd just break everyone again. |
My initial idea of not adding backward compatibility was that it was easy to fix your code: add the missing parameter, change the types and you're done. I can remove the call to old method in InputAdapter. |
da392dd
to
46e1a2f
Compare
Following the "thumbs up votes" I removed the compatibility call. |
Thank you. Scrolling over your code, I only think it is sad not to support the new feature on GWT. Apart from that, it looked good to me, but I did not test yet. As it is a breaking change, we still have to decide when to pull it in. |
backends/gdx-backend-lwjgl3/src/com/badlogic/gdx/backends/lwjgl3/DefaultLwjgl3Input.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on Lwjgl3 and ScrollbarScrollbarsTest. Works good. Scrollbar scrolls more fluently than before, and horizontal scrolling works great. I'm in high favor to merge as soon as we can merge in breaking changes. @jpauty just explain while you roll back your first code change from the other PR.
backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/DefaultAndroidInput.java
Outdated
Show resolved
Hide resolved
extensions/gdx-tools/src/com/badlogic/gdx/tools/particleeditor/ParticleEditor.java
Outdated
Show resolved
Hide resolved
tests/gdx-tests/src/com/badlogic/gdx/tests/BulletTestCollection.java
Outdated
Show resolved
Hide resolved
I just tested your changes on Mac OS with LWJGL3 and the horizontal scrolling stuff is working like a charm. I didn't notice any reduction in scrolling speed due to your fractional scrolling fixes, but I also wasn't sure how I could reliably test that. |
Also, adding support for devices which report fractional scrolling amounts. E.g. a mouse with a continuous mouse wheel, or a Mac touch pad. This is currently only supported in lwjgl3. It can probably be added to android and maybe to gwt. InputProcessor scrolled method now receives scroll amount for X and Y. Changed type to float to support devices which report fractional scroll amounts. Keeping the original scroll method of InputProcessor for backward compatibility. Updated InputEvent in scene2d accordingly: added scrollAmountX, scrollAmountY attributes and corresponding setters and getters. Input event queue can receive float scrolling values. Updated backends accordingly: lwjgl, lwjgl3, android and gwt.
46e1a2f
to
53190a8
Compare
I've fixed formating. |
Upgrade Notes: For apps that upgrade to libGDX 1.10.0 and were using previous |
Hi,
This is a new PR, with code updated w.r.t. master branch. Closed PR
I prepared a new PR to fix horizontal scrolling support and fractional scrolling.
Currently horizontal scrolling with a touch pad is not supported. More over, devices which report fractional scrolling values, such as touch pads and mouses with continuous wheels are not supported. The scrolling is super fast, because small scroll increments (0.1) are converted to 1 or -1. See my previous PR for more details.
Cheers,
Julien
Also, adding support for devices which report fractional scrolling
amounts. E.g. a mouse with a continuous mouse wheel, or a Mac touch
pad. This is currently only supported in lwjgl3. It can probably be
added to android and maybe to gwt.
InputProcessor scrolled method now receives scroll amount for X and
Y. Changed type to float to support devices which report fractional
scroll amounts. Updated InputEvent in scene2d accordingly: added
scrollAmountX, scrollAmountY attributes and corresponding setters and
getters.
Input event queue can receive float scrolling values. Since the queue
stores the events with integers. Scrolling values are stored in fixed
precision format, with 8 bits for the fraction.
Updated backends accordingly: lwjgl, lwjgl3, android and gwt.