Added ability to adjust options sliders with arrow keys - #429
Open
guzrdo wants to merge 2 commits into
Open
Conversation
Contributor
|
Linking #399. |
tpenguinltg
reviewed
Sep 3, 2018
| * Increments or decrements slider value if user presses right or left arrow key. | ||
| * @param key the pressed key | ||
| */ | ||
| private void adjustSliderWithKey(int key) { |
Contributor
There was a problem hiding this comment.
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); |
Contributor
There was a problem hiding this comment.
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.
Contributor
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.