mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 06:52:55 +08:00
Tidy up order of scroll changes
This commit is contained in:
parent
d1c6e3f620
commit
09a6d1184a
@ -89,8 +89,10 @@ namespace osu.Game.Overlays.Chat
|
||||
|
||||
private void newMessagesArrived(IEnumerable<Message> newMessages)
|
||||
{
|
||||
bool shouldScrollToEnd = scroll.IsScrolledToEnd(10) || !chatLines.Any() || newMessages.Any(m => m is LocalMessage);
|
||||
|
||||
// Add up to last Channel.MAX_HISTORY messages
|
||||
var displayMessages = newMessages.Skip(Math.Max(0, newMessages.Count() - Channel.MaxHistory));
|
||||
var displayMessages = newMessages.Skip(Math.Max(0, newMessages.Count() - Channel.MAX_HISTORY));
|
||||
|
||||
Message lastMessage = chatLines.LastOrDefault()?.Message;
|
||||
|
||||
@ -103,19 +105,18 @@ namespace osu.Game.Overlays.Chat
|
||||
lastMessage = message;
|
||||
}
|
||||
|
||||
if (scroll.IsScrolledToEnd(10) || !chatLines.Any() || newMessages.Any(m => m is LocalMessage))
|
||||
scrollToEnd();
|
||||
|
||||
var staleMessages = chatLines.Where(c => c.LifetimeEnd == double.MaxValue).ToArray();
|
||||
int count = staleMessages.Length - Channel.MAX_HISTORY;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var d = staleMessages[i];
|
||||
if (!scroll.IsScrolledToEnd(10))
|
||||
scroll.OffsetScrollPosition(-d.DrawHeight);
|
||||
scroll.OffsetScrollPosition(-d.DrawHeight);
|
||||
d.Expire();
|
||||
}
|
||||
|
||||
if (shouldScrollToEnd)
|
||||
scrollToEnd();
|
||||
}
|
||||
|
||||
private void pendingMessageResolved(Message existing, Message updated)
|
||||
|
Loading…
Reference in New Issue
Block a user