1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 13:37:25 +08:00

Remove unnecessary OnMouseDown/Up from SpinnerDisc

This commit is contained in:
Shane Woolcock 2017-08-16 17:25:48 +09:30
parent 9e5deb63d1
commit 9448e2f192

View File

@ -67,30 +67,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
} }
} }
private void updateTracking()
{
Tracking = mouseHasMainButtonPressed || actionLeftButtonPressed || actionRightButtonPressed;
}
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{
mouseHasMainButtonPressed |= state.Mouse.HasMainButtonPressed;
updateTracking();
return base.OnMouseDown(state, args);
}
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
{
mouseHasMainButtonPressed &= state.Mouse.HasMainButtonPressed;
updateTracking();
return base.OnMouseUp(state, args);
}
protected override bool OnMouseMove(InputState state) protected override bool OnMouseMove(InputState state)
{ {
mouseHasMainButtonPressed |= state.Mouse.HasMainButtonPressed;
mousePosition = Parent.ToLocalSpace(state.Mouse.NativeState.Position); mousePosition = Parent.ToLocalSpace(state.Mouse.NativeState.Position);
updateTracking();
return base.OnMouseMove(state); return base.OnMouseMove(state);
} }
@ -98,7 +77,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{ {
actionLeftButtonPressed |= action == OsuAction.LeftButton; actionLeftButtonPressed |= action == OsuAction.LeftButton;
actionRightButtonPressed |= action == OsuAction.RightButton; actionRightButtonPressed |= action == OsuAction.RightButton;
updateTracking(); Tracking = actionLeftButtonPressed || actionRightButtonPressed;
return false; return false;
} }
@ -106,12 +85,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{ {
actionLeftButtonPressed &= action == OsuAction.LeftButton; actionLeftButtonPressed &= action == OsuAction.LeftButton;
actionRightButtonPressed &= action == OsuAction.RightButton; actionRightButtonPressed &= action == OsuAction.RightButton;
updateTracking(); Tracking = actionLeftButtonPressed || actionRightButtonPressed;
return false; return false;
} }
private Vector2 mousePosition; private Vector2 mousePosition;
private bool mouseHasMainButtonPressed;
private bool actionLeftButtonPressed; private bool actionLeftButtonPressed;
private bool actionRightButtonPressed; private bool actionRightButtonPressed;