mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
Merge pull request #21 from seth-visere/master
Backbone.js getter and setter methods
This commit is contained in:
commit
8f8d7f8fdc
@ -134,12 +134,12 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href='https://github.com/dataarts/dat.gui/raw/build/DAT.GUI.min.js'><strong>Download the minified source</strong></a>
|
<a href='https://github.com/dataarts/dat.gui/raw/build/DAT.GUI.min.js'><strong>Download the minified source</strong></a>
|
||||||
<small id='buildsizemin'>[19.5kb]
|
<small id='buildsizemin'>[19.6kb]
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href='https://github.com/dataarts/dat.gui/raw/build/DAT.GUI.js'><strong>Download the uncompressed source</strong></a>
|
<a href='https://github.com/dataarts/dat.gui/raw/build/DAT.GUI.js'><strong>Download the uncompressed source</strong></a>
|
||||||
<small id='buildsize'>[33.6kb]
|
<small id='buildsize'>[33.8kb]
|
||||||
</small>
|
</small>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
@ -42,7 +42,13 @@ DAT.GUI.Controller.prototype.unlisten = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
DAT.GUI.Controller.prototype.setValue = function(n) {
|
DAT.GUI.Controller.prototype.setValue = function(n) {
|
||||||
|
if(this.object[this.propertyName] != undefined){
|
||||||
this.object[this.propertyName] = n;
|
this.object[this.propertyName] = n;
|
||||||
|
}else{
|
||||||
|
var o = new Object();
|
||||||
|
o[this.propertyName] = n;
|
||||||
|
this.object.set(o);
|
||||||
|
}
|
||||||
if (this.changeFunction != null) {
|
if (this.changeFunction != null) {
|
||||||
this.changeFunction.call(this, n);
|
this.changeFunction.call(this, n);
|
||||||
}
|
}
|
||||||
@ -51,7 +57,9 @@ DAT.GUI.Controller.prototype.setValue = function(n) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
DAT.GUI.Controller.prototype.getValue = function() {
|
DAT.GUI.Controller.prototype.getValue = function() {
|
||||||
return this.object[this.propertyName];
|
var val = this.object[this.propertyName];
|
||||||
|
if(val == undefined) this.object.get(this.propertyName);
|
||||||
|
return val;
|
||||||
};
|
};
|
||||||
|
|
||||||
DAT.GUI.Controller.prototype.updateDisplay = function() {
|
DAT.GUI.Controller.prototype.updateDisplay = function() {
|
||||||
|
@ -307,6 +307,7 @@ DAT.GUI = function(parameters) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var value = object[propertyName];
|
var value = object[propertyName];
|
||||||
|
if(value == undefined && object.get) value = object.get(propertyName));
|
||||||
|
|
||||||
// Does this value exist? Is it accessible?
|
// Does this value exist? Is it accessible?
|
||||||
if (value == undefined) {
|
if (value == undefined) {
|
||||||
|
Loading…
Reference in New Issue
Block a user