Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

NickGuz
Copy link

@NickGuz NickGuz commented Aug 29, 2018

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.

@tpenguinltg
Copy link
Contributor

tpenguinltg commented Sep 3, 2018

Linking #399.

Copy link
Contributor

@tpenguinltg tpenguinltg left a 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) {
Copy link
Contributor

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);
Copy link
Contributor

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.

@tpenguinltg
Copy link
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants