Fix collection button ids.

This commit is contained in:
Ottermandias 2023-10-02 23:21:07 +02:00
parent 0dc06a1733
commit 8f16aa7ee9
2 changed files with 7 additions and 5 deletions

View file

@ -36,10 +36,10 @@ public class CollectionSelectHeader
var buttonSize = new Vector2(comboWidth * 3f / 4f, 0f); var buttonSize = new Vector2(comboWidth * 3f / 4f, 0f);
using (var _ = ImRaii.Group()) using (var _ = ImRaii.Group())
{ {
DrawCollectionButton(buttonSize, GetDefaultCollectionInfo()); DrawCollectionButton(buttonSize, GetDefaultCollectionInfo(), 1);
DrawCollectionButton(buttonSize, GetInterfaceCollectionInfo()); DrawCollectionButton(buttonSize, GetInterfaceCollectionInfo(), 2);
DrawCollectionButton(buttonSize, GetPlayerCollectionInfo()); DrawCollectionButton(buttonSize, GetPlayerCollectionInfo(), 3);
DrawCollectionButton(buttonSize, GetInheritedCollectionInfo()); DrawCollectionButton(buttonSize, GetInheritedCollectionInfo(), 4);
_collectionCombo.Draw("##collectionSelector", comboWidth, ColorId.SelectedCollection.Value()); _collectionCombo.Draw("##collectionSelector", comboWidth, ColorId.SelectedCollection.Value());
} }
@ -126,9 +126,10 @@ public class CollectionSelectHeader
}; };
} }
private void DrawCollectionButton(Vector2 buttonWidth, (ModCollection?, string, string, bool) tuple) private void DrawCollectionButton(Vector2 buttonWidth, (ModCollection?, string, string, bool) tuple, int id)
{ {
var (collection, name, tooltip, disabled) = tuple; var (collection, name, tooltip, disabled) = tuple;
using var _ = ImRaii.PushId(id);
if (ImGuiUtil.DrawDisabledButton(name, buttonWidth, tooltip, disabled)) if (ImGuiUtil.DrawDisabledButton(name, buttonWidth, tooltip, disabled))
_activeCollections.SetCollection(collection!, CollectionType.Current); _activeCollections.SetCollection(collection!, CollectionType.Current);
ImGui.SameLine(); ImGui.SameLine();

View file

@ -146,6 +146,7 @@ public class ModsTab : ITab
ImGuiUtil.HoverTooltip(lower.Length > 0 ? $"Execute '/penumbra redraw {lower}'." : $"Execute '/penumbra redraw'."); ImGuiUtil.HoverTooltip(lower.Length > 0 ? $"Execute '/penumbra redraw {lower}'." : $"Execute '/penumbra redraw'.");
} }
using var id = ImRaii.PushId("Redraw");
using var disabled = ImRaii.Disabled(_clientState.LocalPlayer == null); using var disabled = ImRaii.Disabled(_clientState.LocalPlayer == null);
ImGui.SameLine(); ImGui.SameLine();
var buttonWidth = frameHeight with { X = ImGui.GetContentRegionAvail().X / 4 }; var buttonWidth = frameHeight with { X = ImGui.GetContentRegionAvail().X / 4 };