diff --git a/src/DAT/GUI/Controller.js b/src/DAT/GUI/Controller.js index eb06cfc..7128501 100644 --- a/src/DAT/GUI/Controller.js +++ b/src/DAT/GUI/Controller.js @@ -4,7 +4,8 @@ DAT.GUI.Controller = function() { this.object = arguments[1]; this.propertyName = arguments[2]; - if (arguments.length > 0) this.initialValue = this.propertyName[this.object]; + //if (arguments.length > 0) this.initialValue = this.propertyName[this.object]; + if (arguments.length > 0) this.initialValue = this.object[this.propertyName]; this.domElement = document.createElement('div'); this.domElement.setAttribute('class', 'guidat-controller ' + this.type); diff --git a/src/DAT/GUI/GUI.js b/src/DAT/GUI/GUI.js index 98dac43..1ff94b3 100644 --- a/src/DAT/GUI/GUI.js +++ b/src/DAT/GUI/GUI.js @@ -401,6 +401,10 @@ DAT.GUI = function(parameters) { this.reset = function() { // TODO ... Set all values back to their initials. + for (var i = 0, l = DAT.GUI.allControllers.length; i < l; i++) { + // apply to each controller + DAT.GUI.allControllers[i].reset(); + } } this.toggle = function() { @@ -732,4 +736,4 @@ DAT.GUI.removeClass = function(domElement, className) { if (DAT.GUI.getVarFromURL('saveString') != null) { DAT.GUI.load(DAT.GUI.getVarFromURL('saveString')); -} \ No newline at end of file +}