Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions src/dat/controllers/NumberControllerBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
// When pressing enter, you can be as precise as you want.
if (e.keyCode === 13) {
_this.__truncationSuspended = true;
this.blur();
_this.__truncationSuspended = false;
onFinish();
switch (e.key) {
case 'Enter':
{
// When pressing enter, you can be as precise as you want.
_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;
}
}
});

Expand Down