Implement .add( controller ) & its use for custom Controllers.#243
Implement .add( controller ) & its use for custom Controllers.#243awelles wants to merge 1 commit intodataarts:masterfrom
Conversation
See example of a custom controller in example.html.
donmccurdy
left a comment
There was a problem hiding this comment.
Thanks, and sorry for the slow followup. Are you still interested in doing this PR?
| } else if ( params.liClass ) { | ||
| dom.addClass(li, params.liClass); | ||
| } else if ( controller.liClass ) { | ||
| dom.addClass(li, controller.liClass); |
There was a problem hiding this comment.
Are both of these (params.liClass and controller.liClass) needed? If this li will later be set as controller.__li, could the controller add the class itself?
|
|
||
| if (object instanceof Controller) { | ||
| controller = object; | ||
| params = property || { }; |
There was a problem hiding this comment.
params doesn't take a default value normally, so is it OK to omit the || {} here?
|
|
||
| gui.add(new KnobController(api, 'value', 0.5, 25), { | ||
| liClass: 'knobby' | ||
| }); |
There was a problem hiding this comment.
Do you know if this is compatible with the augmentController method here?
Lines 922 to 990 in 096993e
... specifically — can you still remove(), listen(), and name() the KnobController normally? I don't suppose it's possible to override those methods in the subclass, which is unfortunate, but probably not this PR's problem to solve.
|
Hi. what is needed in order for this to be published? |
See example of a custom controller in example.html.
Fixes #4.
I stripped out everything unessential. It's just add( controller ) and a couple examples.
You can include parameters when adding:
gui.add( controller, params );Currently a parameter called
liClasslives here.ObjectStringThis was needed to avoid more special cases in assigning li row class, which is done just after controller class is squared away in GUI.js.