mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 10:17:19 +08:00
Merge pull request #9613 from peppy/fix-menu-cursor-container-allocs
Reduce memory allocations in MenuCursorContainer
This commit is contained in:
commit
4d7d4a7c7a
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
@ -55,7 +54,16 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
return;
|
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)
|
||||||
|
{
|
||||||
|
newTarget = p;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (currentTarget == newTarget)
|
if (currentTarget == newTarget)
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user