mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
Pass only a single parameter to gui.add to automatically add all of its properties
This commit is contained in:
parent
60d2a580e3
commit
320bdb2926
@ -30,9 +30,9 @@
|
|||||||
prettyPrint();
|
prettyPrint();
|
||||||
|
|
||||||
var fizzyText = new FizzyText("dat.gui");
|
var fizzyText = new FizzyText("dat.gui");
|
||||||
|
|
||||||
var gui = new DAT.GUI();
|
var gui = new DAT.GUI();
|
||||||
|
|
||||||
|
|
||||||
// Text field
|
// Text field
|
||||||
gui.add(fizzyText, "message");
|
gui.add(fizzyText, "message");
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ DAT.GUI.ControllerNumber = function() {
|
|||||||
|
|
||||||
numberField.addEventListener('mousewheel', function(e) {
|
numberField.addEventListener('mousewheel', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
_this.setValue(_this.getValue() + Math.abs(e.wheelDeltaY) / e.wheelDeltaY * step);
|
_this.setValue(_this.getValue() + Math.abs(e.wheelDeltaY) / e.wheelDeltaY * _this.getStep());
|
||||||
return false;
|
return false;
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
@ -140,11 +140,11 @@ DAT.GUI.ControllerNumber = function() {
|
|||||||
_this.setValue(newVal);
|
_this.setValue(newVal);
|
||||||
break;
|
break;
|
||||||
case 38: // up
|
case 38: // up
|
||||||
newVal = _this.getValue() + step;
|
newVal = _this.getValue() + _this.getStep();
|
||||||
_this.setValue(newVal);
|
_this.setValue(newVal);
|
||||||
break;
|
break;
|
||||||
case 40: // down
|
case 40: // down
|
||||||
newVal = _this.getValue() - step;
|
newVal = _this.getValue() - _this.getStep();
|
||||||
_this.setValue(newVal);
|
_this.setValue(newVal);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ DAT.GUI.ControllerNumber = function() {
|
|||||||
draggedNumberField = true;
|
draggedNumberField = true;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var newVal = _this.getValue() + dy * step;
|
var newVal = _this.getValue() + dy * _this.getStep();
|
||||||
_this.setValue(newVal);
|
_this.setValue(newVal);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -275,6 +275,14 @@ DAT.GUI = function(parameters) {
|
|||||||
|
|
||||||
this.add = function() {
|
this.add = function() {
|
||||||
|
|
||||||
|
if (arguments.length == 1) {
|
||||||
|
var toReturn = [];
|
||||||
|
for (var i in arguments[0]) {
|
||||||
|
toReturn.push(_this.add(arguments[0], i));
|
||||||
|
}
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
var object = arguments[0];
|
var object = arguments[0];
|
||||||
var propertyName = arguments[1];
|
var propertyName = arguments[1];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user