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);
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);
+3 -8
View File
@@ -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 })