diff --git a/MLEM.Ui/UiControls.cs b/MLEM.Ui/UiControls.cs index a152b38..4c9e636 100644 --- a/MLEM.Ui/UiControls.cs +++ b/MLEM.Ui/UiControls.cs @@ -387,7 +387,7 @@ namespace MLEM.Ui { continue; var distSq = child.Area.DistanceSquared(this.SelectedElement.Area); // both distance and angle play a role in a destination button's priority, so we combine them - var priority = distSq * (angle / MathHelper.TwoPi + 1); + var priority = (distSq + 1) * (angle / MathHelper.PiOver2 + 1); if (closest == null || priority < closestPriority) { closest = child; closestPriority = priority; diff --git a/Sandbox/GameImpl.cs b/Sandbox/GameImpl.cs index 6490d4a..81f0113 100644 --- a/Sandbox/GameImpl.cs +++ b/Sandbox/GameImpl.cs @@ -305,11 +305,13 @@ namespace Sandbox { newPanel.AddChild(new Button(Anchor.TopLeft, new Vector2(100, 20), "Text", "Tooltip text")); this.UiSystem.Add("Panel", newPanel); - var keybind = new Keybind(MouseButton.Left, ModifierKey.Shift); - var keybindPanel = new Panel(Anchor.BottomRight, new Vector2(100, 100), new Vector2(5)); - for (var i = 0; i < 3; i++) { - var button = keybindPanel.AddChild(ElementHelper.KeybindButton(Anchor.AutoLeft, new Vector2(0.5F, 12), keybind, Input, "Press", Keys.Escape, index: i)); - button.Text.TextScale = 0.1F; + var keybindPanel = new Panel(Anchor.BottomRight, new Vector2(130, 150), new Vector2(5)); + for (var i = 0; i < 15; i++) { + var button = keybindPanel.AddChild(new Button(default, default, i.ToString())); + button.Anchor = Anchor.AutoInline; + button.Padding = new Padding(0.5F); + button.SetHeightBasedOnChildren = false; + button.Size = new Vector2(30, 50); } this.UiSystem.Add("Keybinds", keybindPanel); }