mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
numbercontrollerbox to respond to arrow inputs
This commit is contained in:
parent
c2edd82e39
commit
dd1c04acbf
@ -93,12 +93,30 @@ class NumberControllerBox extends NumberController {
|
|||||||
dom.bind(this.__input, 'blur', onBlur);
|
dom.bind(this.__input, 'blur', onBlur);
|
||||||
dom.bind(this.__input, 'mousedown', onMouseDown);
|
dom.bind(this.__input, 'mousedown', onMouseDown);
|
||||||
dom.bind(this.__input, 'keydown', function(e) {
|
dom.bind(this.__input, 'keydown', function(e) {
|
||||||
|
switch (e.key) {
|
||||||
|
case 'Enter':
|
||||||
|
{
|
||||||
// When pressing enter, you can be as precise as you want.
|
// When pressing enter, you can be as precise as you want.
|
||||||
if (e.keyCode === 13) {
|
|
||||||
_this.__truncationSuspended = true;
|
_this.__truncationSuspended = true;
|
||||||
this.blur();
|
this.blur();
|
||||||
_this.__truncationSuspended = false;
|
_this.__truncationSuspended = false;
|
||||||
onFinish();
|
onFinish();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'ArrowUp':
|
||||||
|
{
|
||||||
|
_this.setValue(_this.getValue() + _this.__impliedStep)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'ArrowDown':
|
||||||
|
{
|
||||||
|
_this.setValue(_this.getValue() - _this.__impliedStep)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user