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

Deselect hitobjects that are now not in the selection quad

This commit is contained in:
smoogipoo 2018-02-20 15:06:51 +09:00
parent 2f4925d031
commit 2a5bfdb4b8

View File

@ -155,9 +155,16 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection
/// Selects all hitobjects that are present within the area of a <see cref="Quad"/>.
/// </summary>
/// <param name="screenSpaceQuad">The selection <see cref="Quad"/>.</param>
// Todo: If needed we can severely reduce allocations in this method
private void selectQuad(Quad screenSpaceQuad)
{
playfield.HitObjects.Objects.Where(h => h.IsAlive && h.IsPresent && screenSpaceQuad.Contains(h.SelectionPoint)).ForEach(h => select(h));
var expectedSelection = playfield.HitObjects.Objects.Where(h => h.IsAlive && h.IsPresent && screenSpaceQuad.Contains(h.SelectionPoint)).ToList();
var toRemove = selectedHitObjects.Except(expectedSelection).ToList();
foreach (var obj in toRemove)
deselect(obj);
expectedSelection.ForEach(h => select(h));
}
/// <summary>