-
-
Notifications
You must be signed in to change notification settings - Fork 20
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 an option to always have the tabs visible, if a panel has more than one tab #27
Add an option to always have the tabs visible, if a panel has more than one tab #27
Conversation
Bringing this feature back from 0.x. Not very happy that we're once again not synced with upstream dockable_container, so hopefully gilzoide/godot-dockable-container#27 is merged soon.
Hey @OverloadedOrama , nice stuff, thanks for the addition! Sorry it took me so long to check this PR. To be honest, for me it makes more sense to hide a single tab, even if
Awesome, thank you!
Hmm, I think the logic over hiding/showing tabs should be done in DockablePanel instead of the DockableContainer: the container simply forwards the options to the panels, which are responsible for their own tabs. This logic would likely live in the |
That sounds good to me, I changed it to follow this logic and named the variable
Yeah that makes sense, I agree. I moved the logic to DockablePanel and added a new A slight issue I encountered was that, while the DockableContainer variable is named |
Yeah,
My original idea was to have the options in DockableContainer be the same as TabContainers, so people would sort of already know what they do. But this is debatable, of course, maybe it shouldn't be that way 🤔
Yeah, me neither. I'd say keeping |
I renamed |
I agree! I've tested your branch here and it seems to be working fine, so I guess we can merge it now =] |
This new option ensures than a dockable panel will have its tabs visible, even when
tabs_visible = false
, when it has more than one tab.Above is a panel with just one tab, and below is a panel with two tabs. This happens when
tabs_visible = false
andtabs_visible_if_more_than_one = true
.This is something we did in Pixelorama 0.x, because we wanted to avoid tabs being visible when unnecessary, but I never ported the change here so I thought I might as well do that.
This PR also removes
set_tab_alignment()
andget_tab_align()
, as they were unused because thetab_alignment
variable already has a getter and setter.One thing I'm not too sure about is the variable name
tabs_visible_if_more_than_one
. I feel like this might be a bit too long (althoughuse_hidden_tabs_for_min_size
is also about the same length), but I'm not sure how to make it shorter while also ensuring that its purpose is clear.And I'm also not sure about calling
set_tabs_visible()
in_resort()
. There may be a more optimal way to do this, but without this, tab visibility isn't being updated when a panel gets added/removed/hidden.