gilzoide / godot-dockable-container

Dockable/tiling UI panels Container addon for Godot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Child Reposition Issue

Nif-kun opened this issue · comments

Issue

Example

Conditions to occur

  1. Place three (3) nodes of control type inside DockerContainer.
  2. Follow the layout (make sure the node on the bottom-right side is at the very edge):
    example2
  3. Bottom-right node must have a minimum width, I've set mine to 275.
  4. Turn off Tab Visible of DockerContainer.
  5. Change the theme and replace the TabContainer panel style to either StyleBoxEmpty, StyleBoxFlat, or StyleBoxTexture.
  6. Run and try to resize the window.

Note

  • If the bottom-right node does not have a minimum size, the issue does not occur.
  • If the bottom-right node's layout has the exact(?) or larger size than it's minimum size, the issue does not occur.
  • If the Tab Visible is turned on, the issue does not occur; Regardless of minimum size, layout, or TabContainer panel style.
  • If the TabContainer panel style is a StyleBoxLine, the issue does not occur. However, it will occur if the StyleBoxLine's thickness is below one(1). This is my current solution to the problem.
  • Resizing the window vertically fixes the reposition issue.

I currently don't have any time to look for it in code. But if given a hint or I find it during my spare time, I'll try to make a fix for it.

Wow, that's really weird =S
I've been able to reproduce here as well. Seems like something is off in regards to respecting the minimum size, but only when a style is applied. I'll try looking into it quickly here and see if I can find something of interest for fixing.

Okay, so after some testing I found out the culprit.
Setting the panel style to a colored StyleBoxFlat, we can see that the panels (which subclass TabContainer) are actually receiving the right Rects.
Screenshot_20221106_111153
So the problem is that Reference Controls' content is not updated correctly in these cases.
They were using the NOTIFICATION_SORT_CHILDREN notification to reposition the content. So it seems that Godot does not ask for Containers inside TabContainers to sort their children depending on the panel style and whether resizing horizontally vs vertically. Weird stuff, right?
Changing it to a NOTIFICATION_TRANSFORM_CHANGED solves this issue, I'll soon create a PR with the fix.

Thanks for the report!

@Nif-kun feel free to try the fix before we merge it into the main branch.

FYI I've submitted the new version 1.1.2 with this fix and the new icon to the Asset Store!