mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-15 05:04:15 +01:00
Allow resetting text mod filter with right-click on arrow.
This commit is contained in:
parent
3dc1553429
commit
768016a897
2 changed files with 12 additions and 9 deletions
2
OtterGui
2
OtterGui
|
|
@ -1 +1 @@
|
||||||
Subproject commit 7d0fcdbadf70f59675e8666de014e5dcb67da35d
|
Subproject commit dc4ad8a5fd0347642d3fdae5f2dc17a7fbfacaa1
|
||||||
|
|
@ -652,12 +652,13 @@ public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSyste
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawFilterCombo(ref bool everything)
|
private bool DrawFilterCombo(ref bool everything)
|
||||||
{
|
{
|
||||||
using var combo = ImRaii.Combo("##filterCombo", string.Empty,
|
using var combo = ImRaii.Combo("##filterCombo", string.Empty,
|
||||||
ImGuiComboFlags.NoPreview | ImGuiComboFlags.PopupAlignLeft | ImGuiComboFlags.HeightLargest);
|
ImGuiComboFlags.NoPreview | ImGuiComboFlags.PopupAlignLeft | ImGuiComboFlags.HeightLargest);
|
||||||
|
var ret = ImGui.IsItemClicked(ImGuiMouseButton.Right);
|
||||||
if (!combo)
|
if (!combo)
|
||||||
return;
|
return ret;
|
||||||
|
|
||||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing,
|
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing,
|
||||||
ImGui.GetStyle().ItemSpacing with { Y = 3 * UiHelpers.Scale });
|
ImGui.GetStyle().ItemSpacing with { Y = 3 * UiHelpers.Scale });
|
||||||
|
|
@ -679,10 +680,12 @@ public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSyste
|
||||||
SetFilterDirty();
|
SetFilterDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Add the state filter combo-button to the right of the filter box. </summary>
|
/// <summary> Add the state filter combo-button to the right of the filter box. </summary>
|
||||||
protected override float CustomFilters(float width)
|
protected override (float, bool) CustomFilters(float width)
|
||||||
{
|
{
|
||||||
var pos = ImGui.GetCursorPos();
|
var pos = ImGui.GetCursorPos();
|
||||||
var remainingWidth = width - ImGui.GetFrameHeight();
|
var remainingWidth = width - ImGui.GetFrameHeight();
|
||||||
|
|
@ -693,17 +696,17 @@ public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSyste
|
||||||
ImGui.SetCursorPos(comboPos);
|
ImGui.SetCursorPos(comboPos);
|
||||||
// Draw combo button
|
// Draw combo button
|
||||||
using var color = ImRaii.PushColor(ImGuiCol.Button, Colors.FilterActive, !everything);
|
using var color = ImRaii.PushColor(ImGuiCol.Button, Colors.FilterActive, !everything);
|
||||||
DrawFilterCombo(ref everything);
|
var rightClick = DrawFilterCombo(ref everything);
|
||||||
_tutorial.OpenTutorial(BasicTutorialSteps.ModFilters);
|
_tutorial.OpenTutorial(BasicTutorialSteps.ModFilters);
|
||||||
if (ImGui.IsItemClicked(ImGuiMouseButton.Right))
|
if (rightClick)
|
||||||
{
|
{
|
||||||
_stateFilter = ModFilterExtensions.UnfilteredStateMods;
|
_stateFilter = ModFilterExtensions.UnfilteredStateMods;
|
||||||
SetFilterDirty();
|
SetFilterDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiUtil.HoverTooltip("Filter mods for their activation status.\nRight-Click to clear all filters.");
|
ImGuiUtil.HoverTooltip("Filter mods for their activation status.\nRight-Click to clear all filters.");
|
||||||
ImGui.SetCursorPos(pos);
|
ImGui.SetCursorPos(pos);
|
||||||
return remainingWidth;
|
return (remainingWidth, rightClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue