lil-gui icon indicating copy to clipboard operation
lil-gui copied to clipboard

Function controllers call onChange on click

Open miketucker opened this issue 3 years ago • 1 comments

Lovely library you have going here! Thought it'd be nice to have some sort of callback when a function button is clicked, similar to the onChange with other controllers.

miketucker avatar Dec 29 '21 01:12 miketucker

Thanks!

So I agree, that would be convenient. At one point I thought about making it so that onChange and onFinishChange would be fired on click (given they don't do anything now). It felt a little wrong though: clicking a button isn't really a "change" and it would also trigger the parent GUI's onChange events, etc.

If the library does provide this, I think it would have to be a new method specific to FunctionController. Essentially shorthand for this:

controller.$button.addEventListener( 'click', myFunc );

Wondering aloud what that might be called...

georgealways avatar Dec 29 '21 02:12 georgealways

Hey just an update that this is in 0.18 — see discussion here: https://github.com/georgealways/lil-gui/issues/64#issuecomment-1426786805

georgealways avatar Feb 11 '23 14:02 georgealways