From ebeb44983527d3259e2298ac1df1432acc18c40c Mon Sep 17 00:00:00 2001 From: arahaya Date: Fri, 6 May 2011 00:07:51 +0900 Subject: [PATCH 1/2] added gui.reset() method --- src/DAT/GUI/Controller.js | 3 ++- src/DAT/GUI/GUI.js | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) 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 +} From dbed685363b550898b018d425b0b4cd1d917f17e Mon Sep 17 00:00:00 2001 From: jonobr1 Date: Sat, 18 Jun 2011 14:17:34 -0400 Subject: [PATCH 2/2] compiles fine --- src/DAT/GUI/GUI.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DAT/GUI/GUI.js b/src/DAT/GUI/GUI.js index aa248d0..5981573 100644 --- a/src/DAT/GUI/GUI.js +++ b/src/DAT/GUI/GUI.js @@ -307,7 +307,7 @@ DAT.GUI = function(parameters) { } var value = object[propertyName]; - if(value == undefined && object.get) value = object.get(propertyName)); + if(value == undefined && object.get) value = object.get(propertyName); // Does this value exist? Is it accessible? if (value == undefined) {