-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add functionality to disable folders #106
base: dev
Are you sure you want to change the base?
Conversation
Hi there, thanks for this. So we just crossed over 30kb un-gzipped and I'm starting to get a little self-conscious about file size. I'm already a little bothered by the fact that Controller and GUI duplicate code for show/hide. If we were to do this, I'd want an elegant way for these classes to share code and styles. At one point I tried making them both inherit from some base class to share fields like |
This commit adds a new file: utils/guiUtils.js It contains 2 functions: disableGui & showGui Previously these 2 functions were copy pasted between Controller.js & GUI.js. Now they share the implementation.
Hi @georgealways! Thank you for checking out this PR! About sharing the styles: I don't really know how the scss syntax works :| |
@georgealways |
Are you able to see if these new mixed-in methods appear correctly on the API page? |
Thanks again for looking at that! Just had a chance to try this PR myself, overall looking great. Thoughts on the functionality itself:
I like your change on hover => shared.scss
On
This is petty on my part, but internally, I wish the helper methods were (enable/show) or (disable/hide). The fact that there's one "positive" and one "negative" bugs me. I think you're following my current pattern though, so that one's on me :) Let me know what you think. Appreciate your help! -g |
For me a 'disabled' folder means the user can't open it -> the user can't interact with any of it's fields. That's why I added an automatic close to the disable method. Maybe converting it to a parameter named 'closeOnDisable' with a default value of false is a good compromise?
In this case yes, I might need help with this!
Makes sense! Renamed the mixin to '@can-disable'
This makes sense to me! So then
'disableItem' and 'showItem' names should also make sense to me! Also
maybe 'itemUtils'? Because now it should contain 2 functions ('disableItem' and 'showItem')
Yes, I left them there so that I could use autocompletion & typing checks, removing it makes sense because these are just internal functions.
Makes sense to me! I can rename it if you want to! (Didn't do this one yet) |
672c471
to
1a6cc13
Compare
Thanks so much! Looking awesome.
Well we have the chaining: I also feel like folders should still be foldable/unfoldable in their disabled state... what if GUI.disable() just loops through its children and calls .disable() on each controller? That would also fix the issue of the semi-transparent root. But if you wanted disabled controllers to stay disabled when you enable the parent folder (🙄) you'd be out of luck. Let me know what you think of that idea. Otherwise, I'll take care of semi-transparent root. And I'll take care of show/hide rename for sure. |
Wanted to add, that this is also a feature request from me. I have some toggles, that enable or disable features. So the user doesn't get confused about toggling things which are disabled, I @Degubi Big thanks for taking on this challenge. |
Yep, the chaining solution definitely looks better!
Yeah, this is why I decided to make disabled folders not openable/closable in the first place :| |
Yea, I'm having some trouble with it myself. I took a crack at it in this branch: dev...disable-folders I think it works / looks as intended, but you can still tab into inputs inside a disabled folder. That's what the There's no way to add that attribute to the container element and have it filter down unfortunately. GUI could try to apply that attribute to children on disable, but then we run into a dual state issue: how to remember which controllers weren't enabled when re-enabling the folder? Stepping back, this feels like a lot of complexity when |
Basically copied it from the Controller class to the GUI class.
The only difference is that I made the folder autoclose when disabling it.
At the moment I use this external function to do the same, but I think it makes sense to have this functionality as part of the GUI class instead: