]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix listcontainer constantly disposing children (#37089)
authorNemanja <98561806+EmoGarbage404@users.noreply.github.com>
Thu, 1 May 2025 05:32:37 +0000 (01:32 -0400)
committerGitHub <noreply@github.com>
Thu, 1 May 2025 05:32:37 +0000 (15:32 +1000)
Content.Client/UserInterface/Controls/ListContainer.cs

index 0ee0a67af0a3f67dbbf41df39feded52581a2a40..0bd7d322156dadb2febb9bc39c24ff4e7c610935 100644 (file)
@@ -264,12 +264,6 @@ public class ListContainer : Control
             _updateChildren = false;
 
             var toRemove = new Dictionary<ListData, ListContainerButton>(_buttons);
-            foreach (var child in Children.ToArray())
-            {
-                if (child == _vScrollBar)
-                    continue;
-                RemoveChild(child);
-            }
 
             if (_data.Count > 0)
             {
@@ -292,8 +286,9 @@ public class ListContainer : Control
 
                         if (Toggle && data == _selected)
                             button.Pressed = true;
+                        AddChild(button);
                     }
-                    AddChild(button);
+                    button.SetPositionInParent(i - _topIndex);
                     button.Measure(finalSize);
                 }
             }