From bc38151ab3b6386df2fa12da14e7ddcd7f01b95c Mon Sep 17 00:00:00 2001 From: Kenneth M Date: Mon, 17 Feb 2025 04:43:02 -0600 Subject: [PATCH] Add `EnableBrioScale` --- Brio/UI/BrioStyle.cs | 15 +++++++++++---- Brio/UI/Windows/SettingsWindow.cs | 7 +++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Brio/UI/BrioStyle.cs b/Brio/UI/BrioStyle.cs index ca58a774..8af8979f 100644 --- a/Brio/UI/BrioStyle.cs +++ b/Brio/UI/BrioStyle.cs @@ -6,9 +6,11 @@ public static class BrioStyle { public static bool EnableStyle { get; set; } public static bool EnableColor => Config.ConfigurationService.Instance.Configuration.Appearance.EnableBrioColor; + public static bool EnableScale => Config.ConfigurationService.Instance.Configuration.Appearance.EnableBrioScale; static bool _hasPushed = false; static bool _hasPushedColor = false; + static bool _hasPushedScale = false; static float _lastGlobalScale; public static void PushStyle() @@ -21,8 +23,12 @@ public static void PushStyle() var imIO = ImGui.GetIO(); - //_lastGlobalScale = imIO.FontGlobalScale; - //imIO.FontGlobalScale = 1f; + if(EnableScale) + { + _lastGlobalScale = imIO.FontGlobalScale; + imIO.FontGlobalScale = 1f; + _hasPushedScale = true; + } if(EnableColor) { @@ -32,7 +38,7 @@ public static void PushStyle() PushStyleColor(ImGuiCol.TextDisabled, new Vector4(128, 128, 128, 255)); PushStyleColor(ImGuiCol.WindowBg, new Vector4(25, 25, 25, 248)); - PushStyleColor(ImGuiCol.ChildBg, new Vector4(25, 25, 25, 228)); + PushStyleColor(ImGuiCol.ChildBg, new Vector4(25, 25, 25, 66)); PushStyleColor(ImGuiCol.PopupBg, new Vector4(25, 25, 25, 248)); PushStyleColor(ImGuiCol.Border, new Vector4(44, 44, 44, 255)); @@ -146,7 +152,8 @@ public static void PopStyle() ImGui.PopStyleColor(51); } - //ImGui.GetIO().FontGlobalScale = _lastGlobalScale; + if(_hasPushedScale) + ImGui.GetIO().FontGlobalScale = _lastGlobalScale; } } } diff --git a/Brio/UI/Windows/SettingsWindow.cs b/Brio/UI/Windows/SettingsWindow.cs index b2f092ab..d67ab47e 100644 --- a/Brio/UI/Windows/SettingsWindow.cs +++ b/Brio/UI/Windows/SettingsWindow.cs @@ -200,6 +200,13 @@ private void DrawDisplaySettings() _configurationService.Configuration.Appearance.EnableBrioColor = enableBrioColor; _configurationService.ApplyChange(); } + + bool enableBrioScale = _configurationService.Configuration.Appearance.EnableBrioScale; + if(ImGui.Checkbox("Enable Brio Text Scale", ref enableBrioScale)) + { + _configurationService.Configuration.Appearance.EnableBrioScale = enableBrioScale; + _configurationService.ApplyChange(); + } } private void DrawSceneTab()