You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
create a controller on a number member of your object.
do not specify min or max there.
for eg:
var controller = gui.add(myObject, 'speed');
specify min and max after that:
controller.min( 0 );
controller.max( 500 );
then register event listeners to it
controller.onChange( function(value) { console.log("change"); } );
controller.onFinishChange( function(value) { console.log("finishChange"); } );
The listeners should be called when the user changes the value but they're not.
The culprit is the max() method that in this context triggers reconstruction of
the ui and breaks the event notifications.
I'm using Chrome on Windows 7 with dat.gui downloaded on the 21 dec. 2014.
Here is some code to reproduce the problem:
function MyObject(speed)
{
this.speed = speed;
}
function reproduceBug()
{
var datgui = new dat.GUI();
var myObject = new MyObject(5);
var controller = datgui.add(myObject, 'speed');
controller.min( 0 );
controller.max( 500 );
controller.onChange( function(value) { console.log("change"); } );
controller.onFinishChange( function(value) { console.log("finishChange"); } );
}
Original issue reported on code.google.com by [email protected] on 21 Dec 2014 at 2:34
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 21 Dec 2014 at 2:34The text was updated successfully, but these errors were encountered: