mirror of
https://github.com/ppy/osu
synced 2025-02-05 21:01:37 +00:00
Move scrolling to UpdateAfterChildren
to avoid scheduling
At least that's what I believe "let FillFlow update to new size" means.
This commit is contained in:
parent
9bc1f3f014
commit
9ec0e74813
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays.Chat
|
||||
@ -21,25 +20,12 @@ namespace osu.Game.Overlays.Chat
|
||||
|
||||
private bool trackNewContent = true;
|
||||
|
||||
protected override void Update()
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.Update();
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
// If our behaviour hasn't been overriden and there has been new content added to the container, we should update our scroll position to track it.
|
||||
bool requiresScrollUpdate = trackNewContent && !IsScrolledToEnd();
|
||||
|
||||
if (requiresScrollUpdate)
|
||||
{
|
||||
// Schedule required to allow FillFlow to be the correct size.
|
||||
Schedule(() =>
|
||||
{
|
||||
if (trackNewContent)
|
||||
{
|
||||
if (Current < ScrollableExtent)
|
||||
ScrollToEnd();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (trackNewContent && !IsScrolledToEnd())
|
||||
ScrollToEnd();
|
||||
}
|
||||
|
||||
private void updateTrackState() => trackNewContent = IsScrolledToEnd(auto_scroll_leniency);
|
||||
|
Loading…
Reference in New Issue
Block a user