-
Notifications
You must be signed in to change notification settings - Fork 121
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
Added ability to adjust options sliders with arrow keys #429
base: master
Are you sure you want to change the base?
Conversation
Linking #399. |
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.
Thanks for the PR! I have yet to test this, but here are some minor suggestions.
* Increments or decrements slider value if user presses right or left arrow key. | ||
* @param key the pressed key | ||
*/ | ||
private void adjustSliderWithKey(int key) { |
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.
I think instead of passing in the key, you should pass in something more symbolic, like a delta value.
|
||
// increment or decrement value | ||
if (key == Input.KEY_RIGHT) { | ||
hoverOption.setValue(hoverOption.getIntegerValue() + 1); |
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.
You have oldSliderValue
that holds hoverOption.getIntegerValue()
; you may as well use it here instead of calling the getter again. Same goes for the line below.
I just tested it. It appears to work as expected. It's a bit awkward having to hover over the slider option first, but it's the best we can do with what we have for now, and it's nice having such precise control over the value. |
You can use arrow keys to make +1 or -1 adjustments to options sliders (offset, volume, etc.)
If there's a better way of doing this I'll give it another go but this is functional at least for the time being.