1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 12:17:46 +08:00

Fix multiple control point deletions

This commit is contained in:
smoogipoo 2019-12-06 17:03:54 +09:00
parent d29ccdc25e
commit 2b5f9515de

View File

@ -14,6 +14,7 @@ using osu.Framework.Input;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Screens.Edit.Compose; using osu.Game.Screens.Edit.Compose;
using osuTK; using osuTK;
@ -100,21 +101,15 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
private bool deleteSelected() private bool deleteSelected()
{ {
int countDeleted = 0; List<PathControlPoint> toRemove = Pieces.Where(p => p.IsSelected.Value).Select(p => p.Index).Select(i => slider.Path.ControlPoints[i]).ToList();
foreach (var piece in Pieces)
{
if (piece.IsSelected.Value)
{
slider.Path.ControlPoints.RemoveAt(piece.Index);
countDeleted++;
}
}
// Ensure that there are any points to be deleted // Ensure that there are any points to be deleted
if (countDeleted == 0) if (toRemove.Count == 0)
return false; 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 there are 0 remaining control points, treat the slider as being deleted
if (slider.Path.ControlPoints.Count == 0) if (slider.Path.ControlPoints.Count == 0)
{ {