mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09: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());
|
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]
|
[Test]
|
||||||
public void TestUndoFromInitialState()
|
public void TestUndoFromInitialState()
|
||||||
{
|
{
|
||||||
|
@ -367,14 +367,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
{
|
{
|
||||||
selectionHandler.HandleSelected(blueprint);
|
selectionHandler.HandleSelected(blueprint);
|
||||||
SelectionBlueprints.ChangeChildDepth(blueprint, 1);
|
SelectionBlueprints.ChangeChildDepth(blueprint, 1);
|
||||||
beatmap.SelectedHitObjects.Add(blueprint.HitObject);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onBlueprintDeselected(SelectionBlueprint blueprint)
|
private void onBlueprintDeselected(SelectionBlueprint blueprint)
|
||||||
{
|
{
|
||||||
selectionHandler.HandleDeselected(blueprint);
|
selectionHandler.HandleDeselected(blueprint);
|
||||||
SelectionBlueprints.ChangeChildDepth(blueprint, 0);
|
SelectionBlueprints.ChangeChildDepth(blueprint, 0);
|
||||||
beatmap.SelectedHitObjects.Remove(blueprint.HitObject);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -146,7 +146,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
internal void HandleSelected(SelectionBlueprint blueprint)
|
internal void HandleSelected(SelectionBlueprint blueprint)
|
||||||
{
|
{
|
||||||
selectedBlueprints.Add(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();
|
UpdateVisibility();
|
||||||
}
|
}
|
||||||
@ -158,6 +161,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
internal void HandleDeselected(SelectionBlueprint blueprint)
|
internal void HandleDeselected(SelectionBlueprint blueprint)
|
||||||
{
|
{
|
||||||
selectedBlueprints.Remove(blueprint);
|
selectedBlueprints.Remove(blueprint);
|
||||||
|
|
||||||
EditorBeatmap.SelectedHitObjects.Remove(blueprint.HitObject);
|
EditorBeatmap.SelectedHitObjects.Remove(blueprint.HitObject);
|
||||||
|
|
||||||
UpdateVisibility();
|
UpdateVisibility();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user