mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 11:03:05 +08:00
Fix quick-deleting unselected slider path control point also deleting all selected control points
Closes https://github.com/ppy/osu/issues/31308.
Logic matches corresponding quick-delete logic in
130802e480/osu.Game/Screens/Edit/Compose/Components/SelectionHandler.cs (L307-L316)
.
This commit is contained in:
parent
aa67f87fe9
commit
182f998f9b
@ -137,11 +137,27 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
/// <summary>
|
||||
/// Delete all visually selected <see cref="PathControlPoint"/>s.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns>Whether any change actually took place.</returns>
|
||||
public bool DeleteSelected()
|
||||
{
|
||||
List<PathControlPoint> toRemove = Pieces.Where(p => p.IsSelected.Value).Select(p => p.ControlPoint).ToList();
|
||||
|
||||
if (!Delete(toRemove))
|
||||
return false;
|
||||
|
||||
// Since pieces are re-used, they will not point to the deleted control points while remaining selected
|
||||
foreach (var piece in Pieces)
|
||||
piece.IsSelected.Value = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete the specified <see cref="PathControlPoint"/>s.
|
||||
/// </summary>
|
||||
/// <returns>Whether any change actually took place.</returns>
|
||||
public bool Delete(List<PathControlPoint> toRemove)
|
||||
{
|
||||
// Ensure that there are any points to be deleted
|
||||
if (toRemove.Count == 0)
|
||||
return false;
|
||||
@ -149,11 +165,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
changeHandler?.BeginChange();
|
||||
RemoveControlPointsRequested?.Invoke(toRemove);
|
||||
changeHandler?.EndChange();
|
||||
|
||||
// Since pieces are re-used, they will not point to the deleted control points while remaining selected
|
||||
foreach (var piece in Pieces)
|
||||
piece.IsSelected.Value = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -140,8 +140,11 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
if (hoveredControlPoint == null)
|
||||
return false;
|
||||
|
||||
hoveredControlPoint.IsSelected.Value = true;
|
||||
ControlPointVisualiser?.DeleteSelected();
|
||||
if (hoveredControlPoint.IsSelected.Value)
|
||||
ControlPointVisualiser?.DeleteSelected();
|
||||
else
|
||||
ControlPointVisualiser?.Delete([hoveredControlPoint.ControlPoint]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user