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) protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{ {
if (HasFocus) if (!HasFocus || !bindTarget.IsHovered)
{ return base.OnMouseDown(state, args);
if (bindTarget.IsHovered)
{
if (!AllowMainMouseButtons) if (!AllowMainMouseButtons)
{ {
switch (args.Button) switch (args.Button)
@ -153,15 +152,13 @@ namespace osu.Game.Overlays.KeyBinding
bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state)); bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state));
return true; return true;
} }
}
return base.OnMouseDown(state, args);
}
protected override bool OnMouseUp(InputState state, MouseUpEventArgs 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) if (bindTarget.IsHovered)
finalise(); finalise();
else else
@ -169,9 +166,6 @@ namespace osu.Game.Overlays.KeyBinding
return true; return true;
} }
return base.OnMouseUp(state, args);
}
protected override bool OnWheel(InputState state) protected override bool OnWheel(InputState state)
{ {
if (HasFocus) if (HasFocus)
@ -211,15 +205,12 @@ namespace osu.Game.Overlays.KeyBinding
protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) protected override bool OnKeyUp(InputState state, KeyUpEventArgs args)
{ {
if (HasFocus) if (!HasFocus) return base.OnKeyUp(state, args);
{
finalise(); finalise();
return true; return true;
} }
return base.OnKeyUp(state, args);
}
private void finalise() private void finalise()
{ {
if (bindTarget != null) if (bindTarget != null)