mirror of
https://github.com/ppy/osu
synced 2025-01-05 13:50:03 +00:00
Tidy up conditionals
This commit is contained in:
parent
a26885c1ab
commit
97acff535d
@ -136,40 +136,34 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||
{
|
||||
if (HasFocus)
|
||||
{
|
||||
if (bindTarget.IsHovered)
|
||||
{
|
||||
if (!AllowMainMouseButtons)
|
||||
{
|
||||
switch (args.Button)
|
||||
{
|
||||
case MouseButton.Left:
|
||||
case MouseButton.Right:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!HasFocus || !bindTarget.IsHovered)
|
||||
return base.OnMouseDown(state, args);
|
||||
|
||||
bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state));
|
||||
return true;
|
||||
if (!AllowMainMouseButtons)
|
||||
{
|
||||
switch (args.Button)
|
||||
{
|
||||
case MouseButton.Left:
|
||||
case MouseButton.Right:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnMouseDown(state, args);
|
||||
bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state));
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
|
||||
{
|
||||
if (HasFocus && !state.Mouse.Buttons.Any())
|
||||
{
|
||||
if (bindTarget.IsHovered)
|
||||
finalise();
|
||||
else
|
||||
updateBindTarget();
|
||||
return true;
|
||||
}
|
||||
// don't do anything until the last button is released.
|
||||
if (!HasFocus || state.Mouse.Buttons.Any())
|
||||
return base.OnMouseUp(state, args);
|
||||
|
||||
return base.OnMouseUp(state, args);
|
||||
if (bindTarget.IsHovered)
|
||||
finalise();
|
||||
else
|
||||
updateBindTarget();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnWheel(InputState state)
|
||||
@ -211,13 +205,10 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
|
||||
protected override bool OnKeyUp(InputState state, KeyUpEventArgs args)
|
||||
{
|
||||
if (HasFocus)
|
||||
{
|
||||
finalise();
|
||||
return true;
|
||||
}
|
||||
if (!HasFocus) return base.OnKeyUp(state, args);
|
||||
|
||||
return base.OnKeyUp(state, args);
|
||||
finalise();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void finalise()
|
||||
|
Loading…
Reference in New Issue
Block a user