Closed ciknowles closed 4 years ago
This isn't such a bad idea. It makes you explicitly force the context.
The only issue is that you need to keep references to the InputBindings after addInput calls if you wish to use them later.
Would you consider allowing bindings to be added with a 'key'. Then extending the API to include a getBinding(key) call?
addInput(menu, 'value', {key:'myid',....});
Later on I can then just call tweakpane.getBinding('myid');
Chris
I don't have a plan to add key
because it is not natural, but the first idea (binding handlers to appropriate APIs) looks good.
Fixed in #69. Please wait for the next release.
I noticed when binding to an 'on' event that 'this' is undefined when the handler is called.
For example: tweakpane.addInput(menu, 'value', someconfig) .on('change', myfunction);
where myfunction(value) { //doing something here //but 'this' undefined unless you explicitly call 'bind' on the handler function }
Should 'this' be set to the input interface instance?
Chris