Extend IconBrowserWidget range

Resolves #2074.

Co-authored-by: ItsBexy <103910869+itsbexy@users.noreply.github.com>
This commit is contained in:
Kaz Wolfe 2024-11-12 20:23:53 -08:00
parent e2e11d5f05
commit fd6d52d33b
No known key found for this signature in database
GPG key ID: 258813F53A16EBB4

View file

@ -17,6 +17,8 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
/// </summary>
public class IconBrowserWidget : IDataWindowWidget
{
private const int MaxIconId = 250_000;
private Vector2 iconSize = new(64.0f, 64.0f);
private Vector2 editIconSize = new(64.0f, 64.0f);
@ -24,7 +26,7 @@ public class IconBrowserWidget : IDataWindowWidget
private Task<List<(int ItemId, string Path)>>? iconIdsTask;
private int startRange;
private int stopRange = 200000;
private int stopRange = MaxIconId;
private bool showTooltipImage;
private Vector2 mouseDragStart;
@ -53,8 +55,8 @@ public class IconBrowserWidget : IDataWindowWidget
{
var texm = Service<TextureManager>.Get();
var result = new List<(int ItemId, string Path)>(200000);
for (var iconId = 0; iconId < 200000; iconId++)
var result = new List<(int ItemId, string Path)>(MaxIconId);
for (var iconId = 0; iconId < MaxIconId; iconId++)
{
// // Remove range 170,000 -> 180,000 by default, this specific range causes exceptions.
// if (iconId is >= 170000 and < 180000)
@ -119,12 +121,19 @@ public class IconBrowserWidget : IDataWindowWidget
ImGui.PushItemWidth(ImGui.GetContentRegionAvail().X);
if (ImGui.InputInt("##StartRange", ref this.startRange, 0, 0))
{
this.startRange = Math.Clamp(this.startRange, 0, MaxIconId);
this.valueRange = null;
}
ImGui.NextColumn();
ImGui.PushItemWidth(ImGui.GetContentRegionAvail().X);
if (ImGui.InputInt("##StopRange", ref this.stopRange, 0, 0))
{
this.stopRange = Math.Clamp(this.stopRange, 0, MaxIconId);
this.valueRange = null;
}
ImGui.NextColumn();
ImGui.Checkbox("Show Image in Tooltip", ref this.showTooltipImage);