From 0e9ce0ac8898cff0837552f6eb7ce2d68c9657a7 Mon Sep 17 00:00:00 2001 From: Daniel Wallace Date: Sat, 7 Nov 2026 20:55:27 -0800 Subject: [PATCH] Bar menu: centre the dropdown under its icon The window's left edge sat on the icon's left edge, so its padding pushed the icons right of the parent. Centre the window on the icon instead (still clamped to the viewport). Co-Authored-By: Claude Opus 5.5 --- src/RynthCore.Engine/ImGui/ImGuiBar.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RynthCore.Engine/ImGui/ImGuiBar.cs b/src/RynthCore.Engine/ImGui/ImGuiBar.cs index 59d88bb..e0ef8ff 100644 --- a/src/RynthCore.Engine/ImGui/ImGuiBar.cs +++ b/src/RynthCore.Engine/ImGui/ImGuiBar.cs @@ -585,7 +585,7 @@ internal static class ImGuiBar Vector2 display = ImGuiNET.ImGui.GetIO().DisplaySize; float width = square.X + 8f * s; // WindowPadding (4, 3) each side float height = items.Length * square.Y + (items.Length - 1) * ButtonGap * s + 6f * s; - float x = min.X, y = max.Y; + float x = (min.X + max.X - width) * 0.5f, y = max.Y; // centred under the icon if (display.X > 1 && display.Y > 1) { if (y + height > display.Y && min.Y - height >= 0f) y = min.Y - height; // flush above instead