Handle selection on mouse down instead of click

This is how other elements work, and feels better with drag preselection
This commit is contained in:
Dean Herbert 2019-11-05 02:21:50 +09:00
parent bcf8a6d514
commit 66253a0bd4
1 changed files with 5 additions and 15 deletions

View File

@ -29,8 +29,6 @@ public class PathControlPointPiece : BlueprintPiece<Slider>
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)