Fix state sharing leading to closed popouts

This commit is contained in:
Infi
2024-04-19 21:56:39 +02:00
parent c0f9f83511
commit fd33934497
2 changed files with 10 additions and 16 deletions
+7 -8
View File
@@ -86,6 +86,7 @@ public sealed class ChatLogWindow : Window, IUiComponent
Size = new Vector2(500, 250); Size = new Vector2(500, 250);
SizeCondition = ImGuiCond.FirstUseEver; SizeCondition = ImGuiCond.FirstUseEver;
IsOpen = true;
RespectCloseHotkey = false; RespectCloseHotkey = false;
DisableWindowSounds = true; DisableWindowSounds = true;
@@ -430,13 +431,6 @@ public sealed class ChatLogWindow : Window, IUiComponent
public override unsafe void PreOpenCheck() public override unsafe void PreOpenCheck()
{ {
if (IsHidden)
{
IsOpen = false;
return;
}
IsOpen = true;
Flags = ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse; Flags = ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse;
if (!Plugin.Config.CanMove) if (!Plugin.Config.CanMove)
Flags |= ImGuiWindowFlags.NoMove; Flags |= ImGuiWindowFlags.NoMove;
@@ -454,6 +448,11 @@ public sealed class ChatLogWindow : Window, IUiComponent
_wasDocked = ImGui.IsWindowDocked(); _wasDocked = ImGui.IsWindowDocked();
} }
public override bool DrawConditions()
{
return !IsHidden;
}
public override void Draw() public override void Draw()
{ {
DrawChatLog(); DrawChatLog();
@@ -1188,7 +1187,7 @@ public sealed class ChatLogWindow : Window, IUiComponent
if (PopOutWindows.ContainsKey($"{tab.Name}{i}")) if (PopOutWindows.ContainsKey($"{tab.Name}{i}"))
continue; continue;
var window = new Popout(this, tab, i) { IsOpen = true }; var window = new Popout(this, tab, i);
Plugin.WindowSystem.AddWindow(window); Plugin.WindowSystem.AddWindow(window);
PopOutWindows.Add($"{tab.Name}{i}", window); PopOutWindows.Add($"{tab.Name}{i}", window);
+3 -8
View File
@@ -20,18 +20,14 @@ internal class Popout : Window
Size = new Vector2(350, 350); Size = new Vector2(350, 350);
SizeCondition = ImGuiCond.FirstUseEver; SizeCondition = ImGuiCond.FirstUseEver;
IsOpen = true;
RespectCloseHotkey = false; RespectCloseHotkey = false;
DisableWindowSounds = true; DisableWindowSounds = true;
} }
public override void PreOpenCheck() public override bool DrawConditions()
{ {
if (ChatLogWindow.IsHidden) return !ChatLogWindow.IsHidden;
{
IsOpen = false;
return;
}
IsOpen = true;
} }
public override void PreDraw() public override void PreDraw()
@@ -66,7 +62,6 @@ internal class Popout : Window
public override void PostDraw() public override void PostDraw()
{ {
ChatLogWindow.PopOutDocked[Idx] = ImGui.IsWindowDocked(); ChatLogWindow.PopOutDocked[Idx] = ImGui.IsWindowDocked();
if (ChatLogWindow.Plugin.Config is { OverrideStyle: true, ChosenStyle: not null }) if (ChatLogWindow.Plugin.Config is { OverrideStyle: true, ChosenStyle: not null })