Fixed bug if direct access returned 0

This commit is contained in:
Seth Samuel 2011-06-16 14:43:32 -07:00
parent 1fd9084574
commit f00d4cc957
2 changed files with 5 additions and 3 deletions

View File

@ -42,7 +42,7 @@ DAT.GUI.Controller.prototype.unlisten = function() {
};
DAT.GUI.Controller.prototype.setValue = function(n) {
if(this.object[this.propertyName]){
if(this.object[this.propertyName] != undefined){
this.object[this.propertyName] = n;
}else{
var o = new Object();
@ -57,7 +57,8 @@ DAT.GUI.Controller.prototype.setValue = function(n) {
};
DAT.GUI.Controller.prototype.getValue = function() {
var val = this.object[this.propertyName] || this.object.get(this.propertyName);
var val = this.object[this.propertyName];
if(val == undefined) this.object.get(this.propertyName);
return val;
};

View File

@ -306,7 +306,8 @@ DAT.GUI = function(parameters) {
// return;
}
var value = object[propertyName] || (object.get && object.get(propertyName));
var value = object[propertyName];
if(value == undefined && object.get) value = object.get(propertyName));
// Does this value exist? Is it accessible?
if (value == undefined) {