]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Dynamic Radial Menus (#29678)
authorRinary <72972221+Rinary1@users.noreply.github.com>
Thu, 4 Jul 2024 01:25:25 +0000 (04:25 +0300)
committerGitHub <noreply@github.com>
Thu, 4 Jul 2024 01:25:25 +0000 (11:25 +1000)
* fix

* Clean Some Code

* Some Commentaries

* Update Content.Client/UserInterface/Controls/RadialContainer.cs

* Update Content.Client/UserInterface/Controls/RadialContainer.cs

---------

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Content.Client/UserInterface/Controls/RadialContainer.cs

index be263d12772e550e70d13d1c9cf7f9dcfe1b6742..be9b8817a065140263f891a944aa47ae9ebe9099 100644 (file)
@@ -67,11 +67,18 @@ public class RadialContainer : LayoutContainer
     {
 
     }
-
+       
     protected override void Draw(DrawingHandleScreen handle)
     {
+               
+        const float baseRadius = 100f;
+        const float radiusIncrement = 5f;
+               
         var children = ReserveSpaceForHiddenChildren ? Children : Children.Where(x => x.Visible);
         var childCount = children.Count();
+               
+               // Add padding from the center at higher child counts so they don't overlap.
+               Radius = baseRadius + (childCount * radiusIncrement);
 
         // Determine the size of the arc, accounting for clockwise and anti-clockwise arrangements
         var arc = AngularRange.Y - AngularRange.X;