mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
added key event up and down arrows to controller.number.js
This commit is contained in:
parent
0a220426e9
commit
109474c99c
@ -63,6 +63,20 @@ var NumberController = function() {
|
|||||||
document.addEventListener('mousemove', dragNumberField, false);
|
document.addEventListener('mousemove', dragNumberField, false);
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
// Handle up arrow and down arrow
|
||||||
|
numberField.addEventListener('keyup', function(e) {
|
||||||
|
switch(e.keyCode) {
|
||||||
|
case 38: // up
|
||||||
|
var newVal = _this.getValue() + step;
|
||||||
|
_this.setValue(newVal);
|
||||||
|
break;
|
||||||
|
case 40: // down
|
||||||
|
var newVal = _this.getValue() - step;
|
||||||
|
_this.setValue(newVal);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}, false);
|
||||||
|
|
||||||
document.addEventListener('mouseup', function(e) {
|
document.addEventListener('mouseup', function(e) {
|
||||||
document.removeEventListener('mousemove', dragNumberField, false);
|
document.removeEventListener('mousemove', dragNumberField, false);
|
||||||
GUI.makeSelectable(_this.parent.domElement);
|
GUI.makeSelectable(_this.parent.domElement);
|
||||||
|
Loading…
Reference in New Issue
Block a user