Skip to content

Commit

Permalink
Set focus on detached advanced dyes when opening or toggling with but…
Browse files Browse the repository at this point in the history
…tons.
  • Loading branch information
Ottermandias committed Aug 1, 2024
1 parent ab771fd commit ad79d9c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Glamourer/Gui/Materials/AdvancedDyePopup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public sealed unsafe class AdvancedDyePopup(
private Actor _actor;
private byte _selectedMaterial = byte.MaxValue;
private bool _anyChanged;
private bool _forceFocus;

private const int RowsPerPage = 16;
private int _rowOffset;
Expand Down Expand Up @@ -70,6 +71,7 @@ private void DrawButton(MaterialValueIndex index)
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Palette.ToIconString(), new Vector2(ImGui.GetFrameHeight()),
string.Empty, false, true))
{
_forceFocus = true;
_selectedMaterial = byte.MaxValue;
_drawIndex = isOpen ? null : index;
}
Expand Down Expand Up @@ -195,6 +197,12 @@ private void DrawWindow(ReadOnlySpan<Pointer<Texture>> textures)
ImGui.SetNextWindowSize(new Vector2(width, height));

var window = ImGui.Begin("###Glamourer Advanced Dyes", flags);
if (ImGui.IsWindowAppearing() || _forceFocus)
{
ImGui.SetWindowFocus();
_forceFocus = false;
}

try
{
if (window)
Expand Down

0 comments on commit ad79d9c

Please sign in to comment.