From 3efd198c6c8556e8497933b66b8418a3cfd27e0f Mon Sep 17 00:00:00 2001 From: xPumaa <35280763+xPumaa@users.noreply.github.com> Date: Fri, 7 Oct 2022 21:04:33 +0200 Subject: [PATCH] Child removed to be able to display buttons with icon and text also in tables --- MareSynchronos/UI/UIShared.cs | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/MareSynchronos/UI/UIShared.cs b/MareSynchronos/UI/UIShared.cs index 0705075..341e35e 100644 --- a/MareSynchronos/UI/UIShared.cs +++ b/MareSynchronos/UI/UIShared.cs @@ -605,23 +605,19 @@ public class UiShared : IDisposable var buttonSizeY = (iconSize.Y > textSize.Y ? iconSize.Y : textSize.Y) + padding.Y * 2; var buttonSize = new Vector2(buttonSizeX, buttonSizeY); - if (ImGui.BeginChild(icon.ToIconString() + text, buttonSize)) + if (ImGui.Button("###" + icon.ToIconString() + text, buttonSize)) { - if (ImGui.Button("", buttonSize)) - { - buttonClicked = true; - } - - ImGui.SameLine(); - ImGui.SetCursorPosX(padding.X); - ImGui.PushFont(UiBuilder.IconFont); - ImGui.Text(icon.ToIconString()); - ImGui.PopFont(); - ImGui.SameLine(); - ImGui.Text(text); - ImGui.EndChild(); + buttonClicked = true; } + ImGui.SameLine(); + ImGui.SetCursorPosX(ImGui.GetCursorPosX() - buttonSize.X - padding.X); + ImGui.PushFont(UiBuilder.IconFont); + ImGui.Text(icon.ToIconString()); + ImGui.PopFont(); + ImGui.SameLine(); + ImGui.Text(text); + return buttonClicked; }