Use ScrollingListNode where applicable

This commit is contained in:
Zeffuro
2026-01-02 10:50:43 +01:00
parent 6a4fc35c07
commit 3044e63106
6 changed files with 21 additions and 28 deletions
@@ -37,8 +37,6 @@ public class AddonConfigurationWindow : NativeAddon
{ {
Position = ContentStartPosition with { Y = tabContentY }, Position = ContentStartPosition with { Y = tabContentY },
Size = ContentSize with { Y = tabContentHeight }, Size = ContentSize with { Y = tabContentHeight },
ContentHeight = 400,
ScrollSpeed = 25,
IsVisible = true, IsVisible = true,
}; };
_generalScrollingAreaNode.AttachNode(this); _generalScrollingAreaNode.AttachNode(this);
@@ -47,8 +45,6 @@ public class AddonConfigurationWindow : NativeAddon
{ {
Position = ContentStartPosition with { Y = tabContentY }, Position = ContentStartPosition with { Y = tabContentY },
Size = ContentSize with { Y = tabContentHeight }, Size = ContentSize with { Y = tabContentHeight },
ContentHeight = 400,
ScrollSpeed = 25,
IsVisible = false, IsVisible = false,
}; };
_categoryScrollingAreaNode.AttachNode(this); _categoryScrollingAreaNode.AttachNode(this);
@@ -57,8 +53,6 @@ public class AddonConfigurationWindow : NativeAddon
{ {
Position = ContentStartPosition with { Y = tabContentY }, Position = ContentStartPosition with { Y = tabContentY },
Size = ContentSize with { Y = tabContentHeight }, Size = ContentSize with { Y = tabContentHeight },
ContentHeight = 400,
ScrollSpeed = 25,
IsVisible = false, IsVisible = false,
}; };
_currencyScrollingAreaNode.AttachNode(this); _currencyScrollingAreaNode.AttachNode(this);
@@ -7,19 +7,18 @@ namespace AetherBags.Nodes.Configuration.Category;
public class CategoryConfigurationNode : ConfigNode<CategoryWrapper> public class CategoryConfigurationNode : ConfigNode<CategoryWrapper>
{ {
private readonly ScrollingAreaNode<VerticalListNode> _categoryList; private readonly ScrollingListNode _categoryList;
private CategoryDefinitionConfigurationNode? _activeNode; private CategoryDefinitionConfigurationNode? _activeNode;
public Action? OnCategoryChanged { get; set; } public Action? OnCategoryChanged { get; set; }
public CategoryConfigurationNode() public CategoryConfigurationNode()
{ {
_categoryList = new ScrollingAreaNode<VerticalListNode> _categoryList = new ScrollingListNode
{ {
ContentHeight = 100.0f, AutoHideScrollbar = true,
AutoHideScrollBar = true,
}; };
_categoryList.ContentNode.FitContents = true; _categoryList.FitContents = true;
_categoryList.AttachNode(this); _categoryList.AttachNode(this);
} }
@@ -37,11 +36,11 @@ public class CategoryConfigurationNode : ConfigNode<CategoryWrapper>
{ {
_activeNode = new CategoryDefinitionConfigurationNode(option.CategoryDefinition) _activeNode = new CategoryDefinitionConfigurationNode(option.CategoryDefinition)
{ {
Size = _categoryList.ContentNode.Size, Size = _categoryList.Size,
OnLayoutChanged = UpdateScrollHeight, OnLayoutChanged = UpdateScrollHeight,
OnCategoryPropertyChanged = OnCategoryChanged, OnCategoryPropertyChanged = OnCategoryChanged,
}; };
_categoryList.ContentNode.AddNode(_activeNode); _categoryList.AddNode(_activeNode);
} }
else else
{ {
@@ -53,17 +52,17 @@ public class CategoryConfigurationNode : ConfigNode<CategoryWrapper>
private void UpdateScrollHeight() private void UpdateScrollHeight()
{ {
_categoryList.ContentNode.RecalculateLayout(); _categoryList.RecalculateLayout();
_categoryList.ContentHeight = _categoryList.ContentNode.Height; //_categoryList.ContentHeight = _categoryList.Height;
} }
protected override void OnSizeChanged() protected override void OnSizeChanged()
{ {
base.OnSizeChanged(); base.OnSizeChanged();
_categoryList.Size = Size; _categoryList.Size = Size;
_categoryList.ContentNode.Width = Width; _categoryList.Width = Width;
foreach (var node in _categoryList.ContentNode.GetNodes<CategoryDefinitionConfigurationNode>()) foreach (var node in _categoryList.GetNodes<CategoryDefinitionConfigurationNode>())
{ {
node.Width = Width; node.Width = Width;
} }
@@ -4,7 +4,7 @@ using KamiToolKit.Nodes;
namespace AetherBags.Nodes.Configuration.Category; namespace AetherBags.Nodes.Configuration.Category;
public sealed class CategoryScrollingAreaNode : ScrollingAreaNode<VerticalListNode> public sealed class CategoryScrollingAreaNode : ScrollingListNode
{ {
private AddonCategoryConfigurationWindow? _categoryConfigurationAddon; private AddonCategoryConfigurationWindow? _categoryConfigurationAddon;
private readonly TextButtonNode _categoryConfigurationButtonNode; private readonly TextButtonNode _categoryConfigurationButtonNode;
@@ -13,7 +13,7 @@ public sealed class CategoryScrollingAreaNode : ScrollingAreaNode<VerticalListNo
{ {
InitializeCategoryAddon(); InitializeCategoryAddon();
ContentNode.AddNode(new CategoryGeneralConfigurationNode()); AddNode(new CategoryGeneralConfigurationNode());
_categoryConfigurationButtonNode = new TextButtonNode _categoryConfigurationButtonNode = new TextButtonNode
{ {
@@ -21,7 +21,7 @@ public sealed class CategoryScrollingAreaNode : ScrollingAreaNode<VerticalListNo
String = "Configure Categories", String = "Configure Categories",
OnClick = () => _categoryConfigurationAddon?.Toggle(), OnClick = () => _categoryConfigurationAddon?.Toggle(),
}; };
ContentNode.AddNode(_categoryConfigurationButtonNode); AddNode(_categoryConfigurationButtonNode);
} }
private void InitializeCategoryAddon() { private void InitializeCategoryAddon() {
@@ -2,11 +2,11 @@ using KamiToolKit.Nodes;
namespace AetherBags.Nodes.Configuration.Currency; namespace AetherBags.Nodes.Configuration.Currency;
public sealed class CurrencyScrollingAreaNode : ScrollingAreaNode<VerticalListNode> public sealed class CurrencyScrollingAreaNode : ScrollingListNode
{ {
public CurrencyScrollingAreaNode() public CurrencyScrollingAreaNode()
{ {
ContentNode.AddNode(new CurrencyGeneralConfigurationNode AddNode(new CurrencyGeneralConfigurationNode
{ {
Size = Size Size = Size
}); });
@@ -5,7 +5,7 @@ using KamiToolKit.Nodes;
namespace AetherBags.Nodes.Configuration.General; namespace AetherBags.Nodes.Configuration.General;
public sealed class GeneralScrollingAreaNode : ScrollingAreaNode<VerticalListNode> public sealed class GeneralScrollingAreaNode : ScrollingListNode
{ {
private readonly CheckboxNode _debugCheckboxNode = null!; private readonly CheckboxNode _debugCheckboxNode = null!;
@@ -13,11 +13,11 @@ public sealed class GeneralScrollingAreaNode : ScrollingAreaNode<VerticalListNod
{ {
GeneralSettings config = System.Config.General; GeneralSettings config = System.Config.General;
ContentNode.ItemSpacing = 32; ItemSpacing = 32;
ContentNode.AddNode(new FunctionalConfigurationNode()); AddNode(new FunctionalConfigurationNode());
ContentNode.AddNode(new LayoutConfigurationNode()); AddNode(new LayoutConfigurationNode());
_debugCheckboxNode = new CheckboxNode _debugCheckboxNode = new CheckboxNode
{ {
@@ -27,6 +27,6 @@ public sealed class GeneralScrollingAreaNode : ScrollingAreaNode<VerticalListNod
IsChecked = config.DebugEnabled, IsChecked = config.DebugEnabled,
OnClick = isChecked => { config.DebugEnabled = isChecked; } OnClick = isChecked => { config.DebugEnabled = isChecked; }
}; };
ContentNode.AddNode(_debugCheckboxNode); AddNode(_debugCheckboxNode);
} }
} }