fix: handle opacity for popped-out windows
This commit is contained in:
+22
-5
@@ -915,21 +915,37 @@ internal sealed class ChatLog : IUiComponent {
|
|||||||
ImGui.EndPopup();
|
ImGui.EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly List<bool> _popOutDocked = new();
|
||||||
|
|
||||||
private void DrawPopOuts() {
|
private void DrawPopOuts() {
|
||||||
this.HandlerLender.ResetCounter();
|
this.HandlerLender.ResetCounter();
|
||||||
foreach (var tab in this.Ui.Plugin.Config.Tabs.Where(tab => tab.PopOut)) {
|
|
||||||
this.DrawPopOut(tab);
|
if (this._popOutDocked.Count != this.Ui.Plugin.Config.Tabs.Count) {
|
||||||
|
this._popOutDocked.Clear();
|
||||||
|
this._popOutDocked.AddRange(Enumerable.Repeat(false, this.Ui.Plugin.Config.Tabs.Count));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < this.Ui.Plugin.Config.Tabs.Count; i++) {
|
||||||
|
var tab = this.Ui.Plugin.Config.Tabs[i];
|
||||||
|
if (!tab.PopOut) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.DrawPopOut(tab, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawPopOut(Tab tab) {
|
private void DrawPopOut(Tab tab, int idx) {
|
||||||
var flags = ImGuiWindowFlags.None;
|
var flags = ImGuiWindowFlags.None;
|
||||||
if (!this.Ui.Plugin.Config.ShowPopOutTitleBar) {
|
if (!this.Ui.Plugin.Config.ShowPopOutTitleBar) {
|
||||||
flags |= ImGuiWindowFlags.NoTitleBar;
|
flags |= ImGuiWindowFlags.NoTitleBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
var alpha = tab.IndependentOpacity ? tab.Opacity : this.Ui.Plugin.Config.WindowAlpha;
|
if (!this._popOutDocked[idx]) {
|
||||||
ImGui.SetNextWindowBgAlpha(alpha / 100f);
|
var alpha = tab.IndependentOpacity ? tab.Opacity : this.Ui.Plugin.Config.WindowAlpha;
|
||||||
|
ImGui.SetNextWindowBgAlpha(alpha / 100f);
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.SetNextWindowSize(new Vector2(350, 350) * ImGuiHelpers.GlobalScale, ImGuiCond.FirstUseEver);
|
ImGui.SetNextWindowSize(new Vector2(350, 350) * ImGuiHelpers.GlobalScale, ImGuiCond.FirstUseEver);
|
||||||
if (!ImGui.Begin($"{tab.Name}##popout", ref tab.PopOut, flags)) {
|
if (!ImGui.Begin($"{tab.Name}##popout", ref tab.PopOut, flags)) {
|
||||||
goto End;
|
goto End;
|
||||||
@@ -948,6 +964,7 @@ internal sealed class ChatLog : IUiComponent {
|
|||||||
ImGui.PopID();
|
ImGui.PopID();
|
||||||
|
|
||||||
End:
|
End:
|
||||||
|
this._popOutDocked[idx] = ImGui.IsWindowDocked();
|
||||||
ImGui.End();
|
ImGui.End();
|
||||||
|
|
||||||
if (!tab.PopOut) {
|
if (!tab.PopOut) {
|
||||||
|
|||||||
Reference in New Issue
Block a user