Skip to content

Commit

Permalink
Fixed CollapsibleList content height being over minimum height someti…
Browse files Browse the repository at this point in the history
…mes (#5058)

fixes new organelle unlocked buttons
  • Loading branch information
hhyyrylainen committed Apr 22, 2024
1 parent 723433b commit 5daaa25
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
10 changes: 3 additions & 7 deletions src/gui_common/CollapsibleList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,21 +326,17 @@ private void OnContainerMinimumSizeChanged()
}

/// <summary>
/// Updates width of the content container as the parent node of it is not a container so it doesn't update that
/// Updates width of the content container as the parent node of it is not a container, so it doesn't update that
/// automatically
/// </summary>
private void AvailableWidthChanged()
{
if (itemContainer == null)
return;

var size = itemContainer.Size;
var wantedWidth = clipBox.Size.X;

if (Math.Abs(size.X - wantedWidth) > 0.001f)
{
size.X = wantedWidth;
itemContainer.Size = size;
}
// Height is reset to 0 to make sure the container doesn't take extra height
itemContainer.Size = new Vector2(wantedWidth, 0);
}
}
3 changes: 1 addition & 2 deletions src/gui_common/CollapsibleList.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ size_flags_vertical = 3
mouse_filter = 2

[node name="GridContainer" type="GridContainer" parent="Clip"]
layout_mode = 2
offset_right = 152.0
layout_mode = 0
mouse_filter = 2

[connection signal="pressed" from="TitleContainer/Buttons/minusButton" to="." method="CollapseButtonPressed"]
Expand Down

0 comments on commit 5daaa25

Please sign in to comment.