Implement control point selection

This commit is contained in:
smoogipoo
2019-10-31 16:23:54 +09:00
parent 7a3ebcd0b1
commit e23a75c64a
2 changed files with 87 additions and 18 deletions

View File

@ -4,6 +4,7 @@
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Osu.Objects;
using osuTK;
@ -21,6 +22,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
this.slider = slider;
RelativeSizeAxes = Axes.Both;
InternalChild = pieces = new Container<PathControlPointPiece> { RelativeSizeAxes = Axes.Both };
}
@ -33,5 +36,23 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
while (slider.Path.ControlPoints.Length < pieces.Count)
pieces.Remove(pieces[pieces.Count - 1]);
}
protected override bool OnMouseDown(MouseDownEvent e)
{
bool anySelected = false;
foreach (var piece in pieces)
{
if (piece.IsHovered)
{
piece.IsSelected.Value = true;
anySelected = true;
}
else
piece.IsSelected.Value = false;
}
return anySelected;
}
}
}