Skip to content

Commit

Permalink
Search bar because fuck scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
Akechi-kun committed Feb 24, 2025
1 parent 9760ddb commit 355bc26
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions BossMod/Config/ModuleViewer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using BossMod.Autorotation;
using Dalamud.Interface;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Utility;
using ImGuiNET;
using Lumina.Excel.Sheets;
using Lumina.Text.ReadOnly;
Expand Down Expand Up @@ -29,6 +30,8 @@ private record struct ModuleGroup(ModuleGroupInfo Info, List<ModuleInfo> Modules
private readonly List<ModuleGroup>[,] _groups;
private readonly Vector2 _iconSize = new(30, 30);

private string _searchText = "";

public ModuleViewer(PlanDatabase? planDB, WorldState ws)
{
_planDB = planDB;
Expand Down Expand Up @@ -132,6 +135,11 @@ private void DrawFilters()
if (!table)
return;

ImGui.TableNextColumn();
ImGui.Text("Search:");
ImGui.SameLine();
ImGui.InputTextWithHint("##search", "e.g. \"Ultimate\"", ref _searchText, 100, ImGuiInputTextFlags.CallbackCompletion);

ImGui.TableNextColumn();
ImGui.TableHeader("Expansion");
ImGui.TableNextRow(ImGuiTableRowFlags.None);
Expand Down Expand Up @@ -200,6 +208,9 @@ private void DrawModules(UITree tree, WorldState ws)

foreach (var group in _groups[i, j])
{
if (!_searchText.IsNullOrEmpty() && !group.Info.Name.Contains(_searchText, StringComparison.OrdinalIgnoreCase))
continue;

ImGui.TableNextRow();
ImGui.TableNextColumn();
UIMisc.Image(Service.Texture?.GetFromGameIcon(_expansions[i].icon), new(36));
Expand Down

0 comments on commit 355bc26

Please sign in to comment.