Skip to content

Added ability to adjust options sliders with arrow keys - #429

Open
guzrdo wants to merge 2 commits into
itdelatrisu:masterfrom
guzrdo:master
Open

Added ability to adjust options sliders with arrow keys#429
guzrdo wants to merge 2 commits into
itdelatrisu:masterfrom
guzrdo:master

Conversation

@guzrdo

@guzrdo guzrdo commented Aug 29, 2018

Copy link
Copy Markdown

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

tpenguinltg commented Sep 3, 2018

Copy link
Copy Markdown
Contributor

Linking #399.

@tpenguinltg tpenguinltg left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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