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 <noreply@anthropic.com>
This commit is contained in:
Daniel Wallace 2026-11-07 20:55:27 -08:00
commit 0e9ce0ac88

View file

@ -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