From 4f95775279a2bea0d687c98e58000672ce270ebf Mon Sep 17 00:00:00 2001 From: Seth Date: Mon, 20 Jun 2011 20:26:51 -0700 Subject: [PATCH 1/2] Fixed backbone bugs --- index.html | 2 +- src/DAT/GUI/Controller.js | 2 +- src/DAT/GUI/GUI.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 15cb0c7..1192513 100644 --- a/index.html +++ b/index.html @@ -139,7 +139,7 @@
  • Download the uncompressed source - [33.8kb] + [33.9kb]
  • diff --git a/src/DAT/GUI/Controller.js b/src/DAT/GUI/Controller.js index 1e41a82..5ee6249 100644 --- a/src/DAT/GUI/Controller.js +++ b/src/DAT/GUI/Controller.js @@ -58,7 +58,7 @@ DAT.GUI.Controller.prototype.setValue = function(n) { DAT.GUI.Controller.prototype.getValue = function() { var val = this.object[this.propertyName]; - if(val == undefined) this.object.get(this.propertyName); + if(val == undefined) val = this.object.get(this.propertyName); return val; }; diff --git a/src/DAT/GUI/GUI.js b/src/DAT/GUI/GUI.js index fa098be..ea49f8b 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) { From 0cd4229d4b109e663891e6ca73fd113e60b6b4b8 Mon Sep 17 00:00:00 2001 From: arahaya Date: Thu, 5 May 2011 23:07:51 +0800 Subject: [PATCH 2/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 5ee6249..eb744d9 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 ea49f8b..5981573 100644 --- a/src/DAT/GUI/GUI.js +++ b/src/DAT/GUI/GUI.js @@ -402,6 +402,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() { @@ -733,4 +737,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 +}