From 92457c3517afb7eefce1ca82aa6e70a047856aae Mon Sep 17 00:00:00 2001 From: Rinary <72972221+Rinary1@users.noreply.github.com> Date: Thu, 4 Jul 2024 04:25:25 +0300 Subject: [PATCH] Dynamic Radial Menus (#29678) * 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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Content.Client/UserInterface/Controls/RadialContainer.cs b/Content.Client/UserInterface/Controls/RadialContainer.cs index be263d12772..be9b8817a06 100644 --- a/Content.Client/UserInterface/Controls/RadialContainer.cs +++ b/Content.Client/UserInterface/Controls/RadialContainer.cs @@ -67,11 +67,18 @@ public RadialContainer() { } - + 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;