From a85f0b5d404a78b63adbba58c593810c3e16e06d Mon Sep 17 00:00:00 2001 From: Anna Date: Wed, 7 Sep 2022 13:49:14 -0400 Subject: [PATCH] owo --- client/Ui/ImGuiExt.cs | 12 ++++++++++-- client/Ui/MainWindowTabs/Settings.cs | 4 +++- client/Ui/Viewer.cs | 4 ++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/client/Ui/ImGuiExt.cs b/client/Ui/ImGuiExt.cs index fb6adbc..6f59128 100644 --- a/client/Ui/ImGuiExt.cs +++ b/client/Ui/ImGuiExt.cs @@ -4,19 +4,27 @@ using ImGuiNET; namespace OrangeGuidanceTomestone.Ui; internal static class ImGuiExt { - internal static bool SmallIconButton(FontAwesomeIcon icon, string? id = null) { + private static bool InternalIconButton(Func func, FontAwesomeIcon icon, string? id = null) { var label = icon.ToIconString(); if (id != null) { label += $"##{id}"; } ImGui.PushFont(UiBuilder.IconFont); - var ret = ImGui.SmallButton(label); + var ret = func(label); ImGui.PopFont(); return ret; } + internal static bool SmallIconButton(FontAwesomeIcon icon, string? id = null) { + return InternalIconButton(ImGui.SmallButton, icon, id); + } + + internal static bool IconButton(FontAwesomeIcon icon, string? id = null) { + return InternalIconButton(ImGui.Button, icon, id); + } + internal static void HelpIcon(string text) { var colour = ImGui.GetStyle().Colors[(int) ImGuiCol.TextDisabled]; ImGui.PushStyleColor(ImGuiCol.Text, colour); diff --git a/client/Ui/MainWindowTabs/Settings.cs b/client/Ui/MainWindowTabs/Settings.cs index d2112c3..4b0ecd1 100644 --- a/client/Ui/MainWindowTabs/Settings.cs +++ b/client/Ui/MainWindowTabs/Settings.cs @@ -1,3 +1,4 @@ +using System.Numerics; using ImGuiNET; using OrangeGuidanceTomestone.Helpers; @@ -40,6 +41,7 @@ internal class Settings : ITab { .Max(); var leftOver = ImGui.GetContentRegionAvail().X - widestTabName - ImGui.GetStyle().ItemSpacing.X - ImGui.GetStyle().FrameBorderSize; + var childHeight = ImGui.GetContentRegionAvail().Y - ImGui.GetStyle().ItemSpacing.Y * 2; if (ImGui.BeginTable("##settings-tabs", 2)) { ImGui.TableSetupColumn("##names", ImGuiTableColumnFlags.None, widestTabName + ImGui.GetStyle().ItemSpacing.X); ImGui.TableSetupColumn("##content", ImGuiTableColumnFlags.None, leftOver); @@ -56,7 +58,7 @@ internal class Settings : ITab { } if (ImGui.TableSetColumnIndex(1)) { - if (ImGui.BeginChild("##tab-content-child")) { + if (ImGui.BeginChild("##tab-content-child", new Vector2(-1, childHeight))) { var (_, draw) = this.Tabs[this._tab]; draw(ref anyChanged, ref vfx); } diff --git a/client/Ui/Viewer.cs b/client/Ui/Viewer.cs index 29e6310..ba9edba 100644 --- a/client/Ui/Viewer.cs +++ b/client/Ui/Viewer.cs @@ -70,7 +70,7 @@ internal class Viewer { ImGui.BeginDisabled(); } - if (ImGui.Button("<")) { + if (ImGuiExt.IconButton(FontAwesomeIcon.AngleLeft)) { this._idx -= 1; } @@ -167,7 +167,7 @@ internal class Viewer { ImGui.BeginDisabled(); } - if (ImGui.Button(">")) { + if (ImGuiExt.IconButton(FontAwesomeIcon.AngleRight)) { this._idx += 1; }