furyphoenix / dat-gui

Automatically exported from code.google.com/p/dat-gui
0 stars 0 forks source link

changing bounds of variable dynamically #45

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Not a issue, more like a feature reques.

Is it possible to update a max bound value when another variable changes?

Example:

var settings = { max: 10, totalPoints: 10 }

gui.add(settings, 'max', 0, 10);
gui.add(settings, 'totalPoints, 0, @settings.max)

So when I change the max value to 6, I wanted the same behaviour like:
gui.add(settings, 'totalPoints, 0, 6)

Original issue reported on code.google.com by venancio...@gmail.com on 12 Dec 2013 at 12:37

GoogleCodeExporter commented 9 years ago
Try this:

controllerMax = gui.add(settings, 'max', 0, 10);
controllerMax.onFinishChange(function () { 
controllerMax.__max = new_max_value;
 });

Original comment by giuseppe...@gmail.com on 9 Jun 2015 at 5:34