From 66253a0bd4142166cb7164bb0d9aca4712b9b6e3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Nov 2019 02:21:50 +0900 Subject: [PATCH] Handle selection on mouse down instead of click This is how other elements work, and feels better with drag preselection --- .../Components/PathControlPointPiece.cs | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs index cfcd266c7f..0353ba241c 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointPiece.cs @@ -29,8 +29,6 @@ public class PathControlPointPiece : BlueprintPiece private readonly Container marker; private readonly Drawable markerRing; - private bool isClicked; - [Resolved] private OsuColour colours { get; set; } @@ -101,7 +99,7 @@ private void updateMarkerDisplay() markerRing.Alpha = IsSelected.Value ? 1 : 0; Color4 colour = isSegmentSeparator ? colours.Red : colours.Yellow; - if (IsHovered || isClicked || IsSelected.Value) + if (IsHovered || IsSelected.Value) colour = Color4.White; marker.Colour = colour; } @@ -126,18 +124,6 @@ private void updateConnectingPath() public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => marker.ReceivePositionalInputAt(screenSpacePos); protected override bool OnMouseDown(MouseDownEvent e) - { - isClicked = true; - return false; - } - - protected override bool OnMouseUp(MouseUpEvent e) - { - isClicked = false; - return false; - } - - protected override bool OnClick(ClickEvent e) { if (RequestSelection != null) { @@ -148,6 +134,10 @@ protected override bool OnClick(ClickEvent e) return false; } + protected override bool OnMouseUp(MouseUpEvent e) => RequestSelection != null; + + protected override bool OnClick(ClickEvent e) => RequestSelection != null; + protected override bool OnDragStart(DragStartEvent e) => true; protected override bool OnDrag(DragEvent e)