Skip to content

Commit

Permalink
left/right keys update NummberSpinner, #318
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Nov 2, 2017
1 parent 3a767dd commit 6d02c27
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions js/NumberSpinner.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,21 @@ define( function( require ) {
if ( Input.isNumberKey( event.keyCode ) || event.keyCode === Input.KEY_SPACE ) {
event.preventDefault();
}

// If no enabled, then don't update the numberProperty based on arrows
if ( !self.enabledProperty.get() ) {
return;
}

// Left arrow decrements
if ( event.keyCode === Input.KEY_LEFT_ARROW ) {
numberProperty.get() > rangeProperty.get().min && decrementFunction();
}

// Right arrow increments
else if ( event.keyCode === Input.KEY_RIGHT_ARROW ) {
numberProperty.get() < rangeProperty.get().max && incrementFunction();
}
},
input: function( event ) {

Expand Down

0 comments on commit 6d02c27

Please sign in to comment.