1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 06:07:25 +08:00

Simplify implementation

This commit is contained in:
Dean Herbert 2019-09-03 19:20:23 +09:00
parent e88965b433
commit 299d528654

View File

@ -36,11 +36,9 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnMouseUp(MouseUpEvent e)
{
bool shouldPlayEffect = buttons.Contains(e.Button);
// examine the button pressed first for short-circuiting
// in most usages it is more likely that another button was pressed than that the cursor left the drawable bounds
if (shouldPlayEffect && Contains(e.ScreenSpaceMousePosition))
if (buttons.Contains(e.Button) && Contains(e.ScreenSpaceMousePosition))
sampleClick?.Play();
return base.OnMouseUp(e);
}