From d0a940c1f3deee1bafa8bd6276fb2b5b8c87854e Mon Sep 17 00:00:00 2001 From: Alek-ban Date: Mon, 2 Mar 2026 14:46:50 +0300 Subject: [PATCH] fix: SectionPanel tuntime ChildrenSoruce change --- GSS2.UI.Core/SectionPanel.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/GSS2.UI.Core/SectionPanel.cs b/GSS2.UI.Core/SectionPanel.cs index 363d82c..f1b5089 100644 --- a/GSS2.UI.Core/SectionPanel.cs +++ b/GSS2.UI.Core/SectionPanel.cs @@ -25,6 +25,8 @@ public class SectionPanel : Panel return value; if (sectionPanel.Cyclic) return value; + if (sectionPanel.Children.Count() == 0) + return 0; return Math.Clamp(value, 0, sectionPanel.Children.Count() - 1); }); public int CurrentIndex @@ -119,6 +121,14 @@ public class SectionPanel : Panel foreach (var control in controls) panel.Children.Add(control); + + if (_initialized) + { + _childIndeces.Clear(); + foreach (var (i, child) in Children.Enumerate()) + _childIndeces.Add(child, i); + _initialized = true; + } } panel.InvalidateArrange(); });