quicksettings
quicksettings copied to clipboard
Correlated values + setValue + Soft Update
Firstly, my sincere thanks and compliments to such a beautiful framework and viable alternative to dat.GUI. I am trying to use QuickSettings as the GUI layer for my framework. To keep the GUI separate from my framework it is necessary for me to create some sort of binding mechanisms. But there is one scenario where it will lead to recursion. Let me show an example
var settings = QuickSettings.create(0,0,'Bind and Safe');
var proportionate = {
_a: 5,
_b: 10,
_ratio: 2,
set a(value)
{
this._a = value;
this._b = this._a * this._ratio;
settings.setValue('b', this._b);
},
set b(value)
{
this._b = value;
this._a = this._b / this._ratio;
settings.setValue('a', this._a);
}
};
settings.bindRange('a', 0, 10, 1.0, 1.0, proportionate);
settings.bindRange("b", 0, 20, 2.0, 1.0, proportionate);
In the above scenario I will add two controls in quicksettings for a
and b
for the proportionate
. So when I change the slider for a
I will also internally change the value for b
. So to update the GUI a call to settings.setValue
is made. So given the above scenario will that not lead to recursion? Becaues even by calling setValue
it again calls to set the object's setter, which will eventually call the setValue
again. Thus it will be an infinite recursion. Is there a way to softly update the GUI?
Regards, #0K
I came here to ask this... I want to update the values in a dropDown...