1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 02:22:55 +08:00

invalidate scroll position

This commit is contained in:
Davran Dilshat 2021-08-23 17:13:25 +01:00
parent 20222f09c4
commit 6bea744e34
2 changed files with 4 additions and 6 deletions

View File

@ -202,8 +202,6 @@ namespace osu.Game.Graphics.Containers
}); });
} }
private int lastKnownChildrenCount;
protected override void UpdateAfterChildren() protected override void UpdateAfterChildren()
{ {
base.UpdateAfterChildren(); base.UpdateAfterChildren();
@ -222,12 +220,10 @@ namespace osu.Game.Graphics.Containers
} }
float currentScroll = scrollContainer.Current; float currentScroll = scrollContainer.Current;
var presentChildren = Children.Where(c => c.IsPresent);
if (currentScroll != lastKnownScroll || presentChildren.Count() != lastKnownChildrenCount) if (currentScroll != lastKnownScroll)
{ {
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)
@ -253,6 +249,8 @@ 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))

View File

@ -211,7 +211,7 @@ namespace osu.Game.Overlays
loading.Hide(); loading.Hide();
searchTextBox.Current.BindValueChanged(term => SectionsContainer.SearchContainer.SearchTerm = term.NewValue, true); searchTextBox.Current.BindValueChanged(term => SectionsContainer.SearchTerm = term.NewValue, true);
searchTextBox.TakeFocus(); searchTextBox.TakeFocus();
loadSidebarButtons(); loadSidebarButtons();