feat: dock above pf when collapsed
This commit is contained in:
parent
555ee73739
commit
c2a136d95c
|
@ -118,31 +118,28 @@ namespace BetterPartyFinder {
|
||||||
private void DrawFiltersWindow() {
|
private void DrawFiltersWindow() {
|
||||||
ImGui.SetNextWindowSize(new Vector2(550f, 510f), ImGuiCond.FirstUseEver);
|
ImGui.SetNextWindowSize(new Vector2(550f, 510f), ImGuiCond.FirstUseEver);
|
||||||
|
|
||||||
var showWindow = this.Visible;
|
var addon = this.Plugin.Config.ShowWhenPfOpen ? this.PartyFinderAddon() : null;
|
||||||
if (!showWindow && this.Plugin.Config.ShowWhenPfOpen) {
|
|
||||||
var addon = this.PartyFinderAddon();
|
|
||||||
if (addon != null && addon.Visible) {
|
|
||||||
showWindow = true;
|
|
||||||
|
|
||||||
if (this.Plugin.Config.WindowSide == WindowSide.Right) {
|
var showWindow = this.Visible || addon?.Visible == true;
|
||||||
float? width;
|
|
||||||
try {
|
|
||||||
width = addon.Width;
|
|
||||||
} catch (NullReferenceException) {
|
|
||||||
width = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (width != null) {
|
|
||||||
ImGui.SetNextWindowPos(new Vector2(addon.X + addon.Width, addon.Y));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!showWindow || !ImGui.Begin(this.Plugin.Name, ref this._visible)) {
|
if (!showWindow || !ImGui.Begin(this.Plugin.Name, ref this._visible)) {
|
||||||
|
if (ImGui.IsWindowCollapsed()) {
|
||||||
|
if (addon != null && addon.Visible) {
|
||||||
|
ImGui.SetWindowPos(new Vector2(addon.X, addon.Y - ImGui.GetFrameHeight()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (addon != null && this.Plugin.Config.WindowSide == WindowSide.Right) {
|
||||||
|
try {
|
||||||
|
ImGui.SetWindowPos(new Vector2(addon.X + addon.Width, addon.Y));
|
||||||
|
} catch (NullReferenceException) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var selected = this.Plugin.Config.SelectedPreset;
|
var selected = this.Plugin.Config.SelectedPreset;
|
||||||
|
|
||||||
string selectedName;
|
string selectedName;
|
||||||
|
@ -250,18 +247,14 @@ namespace BetterPartyFinder {
|
||||||
this.DrawPresetConfiguration(filter);
|
this.DrawPresetConfiguration(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.Plugin.Config.ShowWhenPfOpen && this.Plugin.Config.WindowSide == WindowSide.Left) {
|
if (addon != null && this.Plugin.Config.WindowSide == WindowSide.Left) {
|
||||||
var addon = this.PartyFinderAddon();
|
|
||||||
var currentWidth = ImGui.GetWindowWidth();
|
|
||||||
float? addonWidth;
|
|
||||||
try {
|
try {
|
||||||
addonWidth = addon?.Width;
|
_ = addon.Width;
|
||||||
} catch (NullReferenceException) {
|
// only continue if width is set, meaning addon is initialised
|
||||||
addonWidth = null;
|
var currentWidth = ImGui.GetWindowWidth();
|
||||||
}
|
|
||||||
|
|
||||||
if (addon != null && addonWidth != null) {
|
|
||||||
ImGui.SetWindowPos(new Vector2(addon.X - currentWidth, addon.Y));
|
ImGui.SetWindowPos(new Vector2(addon.X - currentWidth, addon.Y));
|
||||||
|
} catch (NullReferenceException) {
|
||||||
|
// ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue