mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 19:53:23 +08:00
Reduce memory allocations in MenuCursorContainer
This commit is contained in:
parent
fb5a54d242
commit
72ace508b6
@ -1,7 +1,6 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
@ -55,7 +54,15 @@ namespace osu.Game.Graphics.Cursor
|
||||
return;
|
||||
}
|
||||
|
||||
var newTarget = inputManager.HoveredDrawables.OfType<IProvideCursor>().FirstOrDefault(t => t.ProvidingUserCursor) ?? this;
|
||||
IProvideCursor newTarget = this;
|
||||
|
||||
foreach (var d in inputManager.HoveredDrawables)
|
||||
{
|
||||
if (!(d is IProvideCursor p) || !p.ProvidingUserCursor) continue;
|
||||
|
||||
newTarget = p;
|
||||
break;
|
||||
}
|
||||
|
||||
if (currentTarget == newTarget)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user