mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 09:07:25 +08:00
Fix multiple control point deletions
This commit is contained in:
parent
d29ccdc25e
commit
2b5f9515de
@ -14,6 +14,7 @@ using osu.Framework.Input;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Screens.Edit.Compose;
|
||||
using osuTK;
|
||||
@ -100,21 +101,15 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
|
||||
private bool deleteSelected()
|
||||
{
|
||||
int countDeleted = 0;
|
||||
|
||||
foreach (var piece in Pieces)
|
||||
{
|
||||
if (piece.IsSelected.Value)
|
||||
{
|
||||
slider.Path.ControlPoints.RemoveAt(piece.Index);
|
||||
countDeleted++;
|
||||
}
|
||||
}
|
||||
List<PathControlPoint> toRemove = Pieces.Where(p => p.IsSelected.Value).Select(p => p.Index).Select(i => slider.Path.ControlPoints[i]).ToList();
|
||||
|
||||
// Ensure that there are any points to be deleted
|
||||
if (countDeleted == 0)
|
||||
if (toRemove.Count == 0)
|
||||
return false;
|
||||
|
||||
foreach (var c in toRemove)
|
||||
slider.Path.ControlPoints.Remove(c);
|
||||
|
||||
// If there are 0 remaining control points, treat the slider as being deleted
|
||||
if (slider.Path.ControlPoints.Count == 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user