matteobruni / object-gui

Object GUI - Javascript Object GUI Editor
MIT License
66 stars 32 forks source link

Dynamically adding new prop via GUI #1105

Open lingster opened 9 months ago

lingster commented 9 months ago

Hi @matteobruni

Thanks for sharing an interesting project.

Just wondering if it is possible to update this so that we could add new props on the fly. In the example we have "group1" with 2 props: "prop1" and "prop2". Could we add a plus "+" button to the GUI, so that if you click on that it would allow you to add a "prop3" and a value for that?

Happy to at potentially submitting a PR for such as feature.

matteobruni commented 9 months ago

Hi @lingster,

This could be a useful feature, I'm committed on tsParticles v3 release and I need some time for it. Feel free to submit a PR on this if you can.

A note on this feature, I think this feature should be configurable, in the new Editor constructor a flag for toggling this feature could be the solution, or even in the AddGroup function, to give the group the feature, instead of the full editor

lingster commented 9 months ago

@matteobruni , yes I agree it should be a toogle or a flag that can be set. I'll see if I can get some time over the next couple of weeks to work on this...I think it might be better at the add group level, then users can choose which group level would have the + displayed.

matteobruni commented 9 months ago

The + icon can be displayed also in the top level of the editor, if I remember correctly it's the new Editor that creates it.