WIP pinning and hoisting
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using AetherBags.Extensions;
|
||||
using AetherBags.Helpers;
|
||||
using AetherBags.Inventory;
|
||||
using AetherBags.Nodes.Layout;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
using KamiToolKit.Classes;
|
||||
using KamiToolKit.Nodes;
|
||||
@@ -107,6 +105,8 @@ public class InventoryCategoryNode : SimpleComponentNode
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsPinnedInConfig => CategorizedInventory.Category?.IsPinned ?? false;
|
||||
|
||||
public void BeginHeaderHover()
|
||||
{
|
||||
_hoverRefs++;
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
using AetherBags.Nodes.Layout;
|
||||
|
||||
namespace AetherBags.Nodes.Inventory;
|
||||
|
||||
public sealed class InventoryCategoryPinCoordinator
|
||||
{
|
||||
public bool ApplyPinnedStates(WrappingGridNode<InventoryCategoryNode> grid)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
using (grid.DeferRecalculateLayout())
|
||||
{
|
||||
foreach (var node in grid.GetNodes<InventoryCategoryNode>())
|
||||
{
|
||||
bool shouldBePinned = node.IsPinnedInConfig;
|
||||
|
||||
bool isPinned = grid.IsPinned(node);
|
||||
|
||||
if (shouldBePinned)
|
||||
{
|
||||
if (!isPinned)
|
||||
{
|
||||
grid.PinNode(node);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isPinned)
|
||||
{
|
||||
grid.UnpinNode(node);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
public bool PrunePinnedNotInGrid(WrappingGridNode<InventoryCategoryNode> grid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user