diff --git a/ChatTwo/Ui/ChatLogWindow.cs b/ChatTwo/Ui/ChatLogWindow.cs index 60893da..b8fe4d6 100644 --- a/ChatTwo/Ui/ChatLogWindow.cs +++ b/ChatTwo/Ui/ChatLogWindow.cs @@ -86,6 +86,7 @@ public sealed class ChatLogWindow : Window, IUiComponent Size = new Vector2(500, 250); SizeCondition = ImGuiCond.FirstUseEver; + IsOpen = true; RespectCloseHotkey = false; DisableWindowSounds = true; @@ -430,13 +431,6 @@ public sealed class ChatLogWindow : Window, IUiComponent public override unsafe void PreOpenCheck() { - if (IsHidden) - { - IsOpen = false; - return; - } - IsOpen = true; - Flags = ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse; if (!Plugin.Config.CanMove) Flags |= ImGuiWindowFlags.NoMove; @@ -454,6 +448,11 @@ public sealed class ChatLogWindow : Window, IUiComponent _wasDocked = ImGui.IsWindowDocked(); } + public override bool DrawConditions() + { + return !IsHidden; + } + public override void Draw() { DrawChatLog(); @@ -1188,7 +1187,7 @@ public sealed class ChatLogWindow : Window, IUiComponent if (PopOutWindows.ContainsKey($"{tab.Name}{i}")) continue; - var window = new Popout(this, tab, i) { IsOpen = true }; + var window = new Popout(this, tab, i); Plugin.WindowSystem.AddWindow(window); PopOutWindows.Add($"{tab.Name}{i}", window); diff --git a/ChatTwo/Ui/Popout.cs b/ChatTwo/Ui/Popout.cs index e873b75..3df1795 100644 --- a/ChatTwo/Ui/Popout.cs +++ b/ChatTwo/Ui/Popout.cs @@ -20,18 +20,14 @@ internal class Popout : Window Size = new Vector2(350, 350); SizeCondition = ImGuiCond.FirstUseEver; + IsOpen = true; RespectCloseHotkey = false; DisableWindowSounds = true; } - public override void PreOpenCheck() + public override bool DrawConditions() { - if (ChatLogWindow.IsHidden) - { - IsOpen = false; - return; - } - IsOpen = true; + return !ChatLogWindow.IsHidden; } public override void PreDraw() @@ -66,7 +62,6 @@ internal class Popout : Window public override void PostDraw() { - ChatLogWindow.PopOutDocked[Idx] = ImGui.IsWindowDocked(); if (ChatLogWindow.Plugin.Config is { OverrideStyle: true, ChosenStyle: not null })