numbercontrollerbox to respond to arrow inputs

This commit is contained in:
Lucas Kellner 2019-04-27 13:41:12 -04:00
parent c2edd82e39
commit dd1c04acbf

View File

@ -93,12 +93,30 @@ class NumberControllerBox extends NumberController {
dom.bind(this.__input, 'blur', onBlur);
dom.bind(this.__input, 'mousedown', onMouseDown);
dom.bind(this.__input, 'keydown', function(e) {
switch (e.key) {
case 'Enter':
{
// When pressing enter, you can be as precise as you want.
if (e.keyCode === 13) {
_this.__truncationSuspended = true;
this.blur();
_this.__truncationSuspended = false;
onFinish();
break;
}
case 'ArrowUp':
{
_this.setValue(_this.getValue() + _this.__impliedStep)
break;
}
case 'ArrowDown':
{
_this.setValue(_this.getValue() - _this.__impliedStep)
break;
}
default:
{
break;
}
}
});