mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Use a better method of cancelling user scroll
This commit is contained in:
@ -25,6 +25,8 @@ namespace osu.Game.Graphics.Containers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool UserScrolling { get; private set; }
|
public bool UserScrolling { get; private set; }
|
||||||
|
|
||||||
|
public void CancelUserScroll() => UserScrolling = false;
|
||||||
|
|
||||||
public UserTrackingScrollContainer()
|
public UserTrackingScrollContainer()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -262,17 +262,21 @@ namespace osu.Game.Overlays.Chat
|
|||||||
base.UpdateAfterChildren();
|
base.UpdateAfterChildren();
|
||||||
|
|
||||||
// If the user has scrolled to the bottom of the container, we should resume tracking new content.
|
// If the user has scrolled to the bottom of the container, we should resume tracking new content.
|
||||||
bool cancelUserScroll = UserScrolling && IsScrolledToEnd(auto_scroll_leniency);
|
if (UserScrolling && IsScrolledToEnd(auto_scroll_leniency))
|
||||||
|
CancelUserScroll();
|
||||||
|
|
||||||
// If the user hasn't overridden our behaviour and there has been new content added to the container, we should update our scroll position to track it.
|
// If the user hasn't overridden our behaviour and there has been new content added to the container, we should update our scroll position to track it.
|
||||||
bool requiresScrollUpdate = !UserScrolling && (lastExtent == null || Precision.AlmostBigger(ScrollableExtent, lastExtent.Value));
|
bool requiresScrollUpdate = !UserScrolling && (lastExtent == null || Precision.AlmostBigger(ScrollableExtent, lastExtent.Value));
|
||||||
|
|
||||||
if (cancelUserScroll || requiresScrollUpdate)
|
if (requiresScrollUpdate)
|
||||||
{
|
{
|
||||||
ScheduleAfterChildren(() =>
|
ScheduleAfterChildren(() =>
|
||||||
{
|
{
|
||||||
ScrollToEnd();
|
if (!UserScrolling)
|
||||||
lastExtent = ScrollableExtent;
|
{
|
||||||
|
ScrollToEnd();
|
||||||
|
lastExtent = ScrollableExtent;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user