mirror of
https://github.com/osukey/osukey.git
synced 2025-05-24 15:07:20 +09:00
update selected section on children count change
This commit is contained in:
parent
34b51100ff
commit
9a507ed273
@ -202,6 +202,8 @@ namespace osu.Game.Graphics.Containers
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int lastKnownChildrenCount = 0;
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
{
|
{
|
||||||
base.UpdateAfterChildren();
|
base.UpdateAfterChildren();
|
||||||
@ -220,10 +222,12 @@ namespace osu.Game.Graphics.Containers
|
|||||||
}
|
}
|
||||||
|
|
||||||
float currentScroll = scrollContainer.Current;
|
float currentScroll = scrollContainer.Current;
|
||||||
|
var presentChildren = Children.Where(c => c.IsPresent);
|
||||||
|
|
||||||
if (currentScroll != lastKnownScroll)
|
if (currentScroll != lastKnownScroll || presentChildren.Count() != lastKnownChildrenCount)
|
||||||
{
|
{
|
||||||
lastKnownScroll = currentScroll;
|
lastKnownScroll = currentScroll;
|
||||||
|
lastKnownChildrenCount = presentChildren.Count();
|
||||||
|
|
||||||
// reset last clicked section because user started scrolling themselves
|
// reset last clicked section because user started scrolling themselves
|
||||||
if (scrollContainer.UserScrolling)
|
if (scrollContainer.UserScrolling)
|
||||||
@ -249,8 +253,6 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
float scrollCentre = fixedHeaderSize + scrollContainer.DisplayableContent * scroll_y_centre + selectionLenienceAboveSection;
|
float scrollCentre = fixedHeaderSize + scrollContainer.DisplayableContent * scroll_y_centre + selectionLenienceAboveSection;
|
||||||
|
|
||||||
var presentChildren = Children.Where(c => c.IsPresent);
|
|
||||||
|
|
||||||
if (lastClickedSection != null)
|
if (lastClickedSection != null)
|
||||||
SelectedSection.Value = lastClickedSection;
|
SelectedSection.Value = lastClickedSection;
|
||||||
else if (Precision.AlmostBigger(0, scrollContainer.Current))
|
else if (Precision.AlmostBigger(0, scrollContainer.Current))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user