1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-30 11:57:21 +08:00

Tidy up conditionals

This commit is contained in:
Dean Herbert 2017-08-22 18:21:00 +09:00
parent a26885c1ab
commit 97acff535d

View File

@ -136,10 +136,9 @@ namespace osu.Game.Overlays.KeyBinding
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{
if (HasFocus)
{
if (bindTarget.IsHovered)
{
if (!HasFocus || !bindTarget.IsHovered)
return base.OnMouseDown(state, args);
if (!AllowMainMouseButtons)
{
switch (args.Button)
@ -153,15 +152,13 @@ namespace osu.Game.Overlays.KeyBinding
bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state));
return true;
}
}
return base.OnMouseDown(state, args);
}
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
{
if (HasFocus && !state.Mouse.Buttons.Any())
{
// don't do anything until the last button is released.
if (!HasFocus || state.Mouse.Buttons.Any())
return base.OnMouseUp(state, args);
if (bindTarget.IsHovered)
finalise();
else
@ -169,9 +166,6 @@ namespace osu.Game.Overlays.KeyBinding
return true;
}
return base.OnMouseUp(state, args);
}
protected override bool OnWheel(InputState state)
{
if (HasFocus)
@ -211,15 +205,12 @@ namespace osu.Game.Overlays.KeyBinding
protected override bool OnKeyUp(InputState state, KeyUpEventArgs args)
{
if (HasFocus)
{
if (!HasFocus) return base.OnKeyUp(state, args);
finalise();
return true;
}
return base.OnKeyUp(state, args);
}
private void finalise()
{
if (bindTarget != null)