mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 11:22:57 +08:00
Merge pull request #10139 from peppy/editor-fix-multiple-selection
Fix editor selected hitobjects containing the selection up to five times
This commit is contained in:
commit
5712d3f0aa
@ -27,6 +27,17 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
AddStep("get beatmap", () => editorBeatmap = Editor.ChildrenOfType<EditorBeatmap>().Single());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSelectedObjects()
|
||||
{
|
||||
HitCircle obj = null;
|
||||
AddStep("add hitobject", () => editorBeatmap.Add(obj = new HitCircle { StartTime = 1000 }));
|
||||
AddStep("select hitobject", () => editorBeatmap.SelectedHitObjects.Add(obj));
|
||||
AddAssert("confirm 1 selected", () => editorBeatmap.SelectedHitObjects.Count == 1);
|
||||
AddStep("deselect hitobject", () => editorBeatmap.SelectedHitObjects.Remove(obj));
|
||||
AddAssert("confirm 0 selected", () => editorBeatmap.SelectedHitObjects.Count == 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUndoFromInitialState()
|
||||
{
|
||||
|
@ -367,14 +367,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
selectionHandler.HandleSelected(blueprint);
|
||||
SelectionBlueprints.ChangeChildDepth(blueprint, 1);
|
||||
beatmap.SelectedHitObjects.Add(blueprint.HitObject);
|
||||
}
|
||||
|
||||
private void onBlueprintDeselected(SelectionBlueprint blueprint)
|
||||
{
|
||||
selectionHandler.HandleDeselected(blueprint);
|
||||
SelectionBlueprints.ChangeChildDepth(blueprint, 0);
|
||||
beatmap.SelectedHitObjects.Remove(blueprint.HitObject);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -146,7 +146,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
internal void HandleSelected(SelectionBlueprint blueprint)
|
||||
{
|
||||
selectedBlueprints.Add(blueprint);
|
||||
EditorBeatmap.SelectedHitObjects.Add(blueprint.HitObject);
|
||||
|
||||
// there are potentially multiple SelectionHandlers active, but we only want to add hitobjects to the selected list once.
|
||||
if (!EditorBeatmap.SelectedHitObjects.Contains(blueprint.HitObject))
|
||||
EditorBeatmap.SelectedHitObjects.Add(blueprint.HitObject);
|
||||
|
||||
UpdateVisibility();
|
||||
}
|
||||
@ -158,6 +161,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
internal void HandleDeselected(SelectionBlueprint blueprint)
|
||||
{
|
||||
selectedBlueprints.Remove(blueprint);
|
||||
|
||||
EditorBeatmap.SelectedHitObjects.Remove(blueprint.HitObject);
|
||||
|
||||
UpdateVisibility();
|
||||
|
Loading…
Reference in New Issue
Block a user