diff --git a/osu.Android.props b/osu.Android.props
index d701aaf199..dc3e14c141 100644
--- a/osu.Android.props
+++ b/osu.Android.props
@@ -52,6 +52,6 @@
-
+
diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaPlacementBlueprintTestScene.cs b/osu.Game.Rulesets.Mania.Tests/Editor/ManiaPlacementBlueprintTestScene.cs
similarity index 97%
rename from osu.Game.Rulesets.Mania.Tests/ManiaPlacementBlueprintTestScene.cs
rename to osu.Game.Rulesets.Mania.Tests/Editor/ManiaPlacementBlueprintTestScene.cs
index 0fe4a3c669..ece523e84c 100644
--- a/osu.Game.Rulesets.Mania.Tests/ManiaPlacementBlueprintTestScene.cs
+++ b/osu.Game.Rulesets.Mania.Tests/Editor/ManiaPlacementBlueprintTestScene.cs
@@ -16,7 +16,7 @@ using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Tests.Visual;
using osuTK.Graphics;
-namespace osu.Game.Rulesets.Mania.Tests
+namespace osu.Game.Rulesets.Mania.Tests.Editor
{
public abstract class ManiaPlacementBlueprintTestScene : PlacementBlueprintTestScene
{
diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaSelectionBlueprintTestScene.cs b/osu.Game.Rulesets.Mania.Tests/Editor/ManiaSelectionBlueprintTestScene.cs
similarity index 95%
rename from osu.Game.Rulesets.Mania.Tests/ManiaSelectionBlueprintTestScene.cs
rename to osu.Game.Rulesets.Mania.Tests/Editor/ManiaSelectionBlueprintTestScene.cs
index 149f6582ab..176fbba921 100644
--- a/osu.Game.Rulesets.Mania.Tests/ManiaSelectionBlueprintTestScene.cs
+++ b/osu.Game.Rulesets.Mania.Tests/Editor/ManiaSelectionBlueprintTestScene.cs
@@ -8,7 +8,7 @@ using osu.Game.Rulesets.Mania.UI;
using osu.Game.Tests.Visual;
using osuTK.Graphics;
-namespace osu.Game.Rulesets.Mania.Tests
+namespace osu.Game.Rulesets.Mania.Tests.Editor
{
public abstract class ManiaSelectionBlueprintTestScene : SelectionBlueprintTestScene
{
diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneEditor.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneEditor.cs
similarity index 96%
rename from osu.Game.Rulesets.Mania.Tests/TestSceneEditor.cs
rename to osu.Game.Rulesets.Mania.Tests/Editor/TestSceneEditor.cs
index 3b9c03b86a..d3afbc63eb 100644
--- a/osu.Game.Rulesets.Mania.Tests/TestSceneEditor.cs
+++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneEditor.cs
@@ -8,7 +8,7 @@ using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Tests.Visual;
-namespace osu.Game.Rulesets.Mania.Tests
+namespace osu.Game.Rulesets.Mania.Tests.Editor
{
[TestFixture]
public class TestSceneEditor : EditorTestScene
diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNotePlacementBlueprint.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneHoldNotePlacementBlueprint.cs
similarity index 93%
rename from osu.Game.Rulesets.Mania.Tests/TestSceneHoldNotePlacementBlueprint.cs
rename to osu.Game.Rulesets.Mania.Tests/Editor/TestSceneHoldNotePlacementBlueprint.cs
index b4332264b9..87c74a12cf 100644
--- a/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNotePlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneHoldNotePlacementBlueprint.cs
@@ -8,7 +8,7 @@ using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
-namespace osu.Game.Rulesets.Mania.Tests
+namespace osu.Game.Rulesets.Mania.Tests.Editor
{
public class TestSceneHoldNotePlacementBlueprint : ManiaPlacementBlueprintTestScene
{
diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneHoldNoteSelectionBlueprint.cs
similarity index 97%
rename from osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteSelectionBlueprint.cs
rename to osu.Game.Rulesets.Mania.Tests/Editor/TestSceneHoldNoteSelectionBlueprint.cs
index 90394f3d1b..24f4c6858e 100644
--- a/osu.Game.Rulesets.Mania.Tests/TestSceneHoldNoteSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneHoldNoteSelectionBlueprint.cs
@@ -12,7 +12,7 @@ using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Tests.Visual;
-namespace osu.Game.Rulesets.Mania.Tests
+namespace osu.Game.Rulesets.Mania.Tests.Editor
{
public class TestSceneHoldNoteSelectionBlueprint : ManiaSelectionBlueprintTestScene
{
diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneManiaBeatSnapGrid.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs
similarity index 98%
rename from osu.Game.Rulesets.Mania.Tests/TestSceneManiaBeatSnapGrid.cs
rename to osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs
index 639be0bc11..654b752001 100644
--- a/osu.Game.Rulesets.Mania.Tests/TestSceneManiaBeatSnapGrid.cs
+++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaBeatSnapGrid.cs
@@ -20,7 +20,7 @@ using osu.Game.Screens.Edit;
using osu.Game.Tests.Visual;
using osuTK;
-namespace osu.Game.Rulesets.Mania.Tests
+namespace osu.Game.Rulesets.Mania.Tests.Editor
{
public class TestSceneManiaBeatSnapGrid : EditorClockTestScene
{
diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaHitObjectComposer.cs
similarity index 99%
rename from osu.Game.Rulesets.Mania.Tests/TestSceneManiaHitObjectComposer.cs
rename to osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaHitObjectComposer.cs
index 1a3fa29d4a..c9551ee79e 100644
--- a/osu.Game.Rulesets.Mania.Tests/TestSceneManiaHitObjectComposer.cs
+++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneManiaHitObjectComposer.cs
@@ -23,7 +23,7 @@ using osu.Game.Tests.Visual;
using osuTK;
using osuTK.Input;
-namespace osu.Game.Rulesets.Mania.Tests
+namespace osu.Game.Rulesets.Mania.Tests.Editor
{
public class TestSceneManiaHitObjectComposer : EditorClockTestScene
{
diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneNotePlacementBlueprint.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNotePlacementBlueprint.cs
similarity index 97%
rename from osu.Game.Rulesets.Mania.Tests/TestSceneNotePlacementBlueprint.cs
rename to osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNotePlacementBlueprint.cs
index 2d97e61aa5..36c34a8fb9 100644
--- a/osu.Game.Rulesets.Mania.Tests/TestSceneNotePlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNotePlacementBlueprint.cs
@@ -18,7 +18,7 @@ using osu.Game.Tests.Visual;
using osuTK;
using osuTK.Input;
-namespace osu.Game.Rulesets.Mania.Tests
+namespace osu.Game.Rulesets.Mania.Tests.Editor
{
public class TestSceneNotePlacementBlueprint : ManiaPlacementBlueprintTestScene
{
diff --git a/osu.Game.Rulesets.Mania.Tests/TestSceneNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNoteSelectionBlueprint.cs
similarity index 96%
rename from osu.Game.Rulesets.Mania.Tests/TestSceneNoteSelectionBlueprint.cs
rename to osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNoteSelectionBlueprint.cs
index 1514bdf0bd..0e47a12a8e 100644
--- a/osu.Game.Rulesets.Mania.Tests/TestSceneNoteSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Mania.Tests/Editor/TestSceneNoteSelectionBlueprint.cs
@@ -12,7 +12,7 @@ using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Tests.Visual;
using osuTK;
-namespace osu.Game.Rulesets.Mania.Tests
+namespace osu.Game.Rulesets.Mania.Tests.Editor
{
public class TestSceneNoteSelectionBlueprint : ManiaSelectionBlueprintTestScene
{
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCirclePlacementBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneHitCirclePlacementBlueprint.cs
similarity index 94%
rename from osu.Game.Rulesets.Osu.Tests/TestSceneHitCirclePlacementBlueprint.cs
rename to osu.Game.Rulesets.Osu.Tests/Editor/TestSceneHitCirclePlacementBlueprint.cs
index 4c6abc45f7..7bccec6c97 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCirclePlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneHitCirclePlacementBlueprint.cs
@@ -9,7 +9,7 @@ using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
-namespace osu.Game.Rulesets.Osu.Tests
+namespace osu.Game.Rulesets.Osu.Tests.Editor
{
public class TestSceneHitCirclePlacementBlueprint : PlacementBlueprintTestScene
{
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneHitCircleSelectionBlueprint.cs
similarity index 98%
rename from osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleSelectionBlueprint.cs
rename to osu.Game.Rulesets.Osu.Tests/Editor/TestSceneHitCircleSelectionBlueprint.cs
index 0ecce42e88..66cd405195 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneHitCircleSelectionBlueprint.cs
@@ -11,7 +11,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
using osuTK;
-namespace osu.Game.Rulesets.Osu.Tests
+namespace osu.Game.Rulesets.Osu.Tests.Editor
{
public class TestSceneHitCircleSelectionBlueprint : SelectionBlueprintTestScene
{
diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs
new file mode 100644
index 0000000000..1ca94df26b
--- /dev/null
+++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneObjectObjectSnap.cs
@@ -0,0 +1,90 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using System.Linq;
+using NUnit.Framework;
+using osu.Framework.Testing;
+using osu.Framework.Utils;
+using osu.Game.Beatmaps;
+using osu.Game.Rulesets.Osu.Objects;
+using osu.Game.Rulesets.Osu.UI;
+using osu.Game.Tests.Beatmaps;
+using osuTK;
+using osuTK.Input;
+
+namespace osu.Game.Rulesets.Osu.Tests.Editor
+{
+ [TestFixture]
+ public class TestSceneObjectObjectSnap : TestSceneOsuEditor
+ {
+ private OsuPlayfield playfield;
+
+ protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestBeatmap(Ruleset.Value, false);
+
+ public override void SetUpSteps()
+ {
+ base.SetUpSteps();
+ AddStep("get playfield", () => playfield = Editor.ChildrenOfType().First());
+ }
+
+ [TestCase(true)]
+ [TestCase(false)]
+ public void TestHitCircleSnapsToOtherHitCircle(bool distanceSnapEnabled)
+ {
+ AddStep("move mouse to centre", () => InputManager.MoveMouseTo(playfield.ScreenSpaceDrawQuad.Centre));
+
+ if (!distanceSnapEnabled)
+ AddStep("disable distance snap", () => InputManager.Key(Key.Q));
+
+ AddStep("enter placement mode", () => InputManager.Key(Key.Number2));
+
+ AddStep("place first object", () => InputManager.Click(MouseButton.Left));
+
+ AddStep("move mouse slightly", () => InputManager.MoveMouseTo(playfield.ScreenSpaceDrawQuad.Centre + new Vector2(playfield.ScreenSpaceDrawQuad.Width * 0.02f, 0)));
+
+ AddStep("place second object", () => InputManager.Click(MouseButton.Left));
+
+ AddAssert("both objects at same location", () =>
+ {
+ var objects = EditorBeatmap.HitObjects;
+
+ var first = (OsuHitObject)objects.First();
+ var second = (OsuHitObject)objects.Last();
+
+ return first.Position == second.Position;
+ });
+ }
+
+ [Test]
+ public void TestHitCircleSnapsToSliderEnd()
+ {
+ AddStep("move mouse to centre", () => InputManager.MoveMouseTo(playfield.ScreenSpaceDrawQuad.Centre));
+
+ AddStep("disable distance snap", () => InputManager.Key(Key.Q));
+
+ AddStep("enter slider placement mode", () => InputManager.Key(Key.Number3));
+
+ AddStep("start slider placement", () => InputManager.Click(MouseButton.Left));
+
+ AddStep("move to place end", () => InputManager.MoveMouseTo(playfield.ScreenSpaceDrawQuad.Centre + new Vector2(playfield.ScreenSpaceDrawQuad.Width * 0.185f, 0)));
+
+ AddStep("end slider placement", () => InputManager.Click(MouseButton.Right));
+
+ AddStep("enter circle placement mode", () => InputManager.Key(Key.Number2));
+
+ AddStep("move mouse slightly", () => InputManager.MoveMouseTo(playfield.ScreenSpaceDrawQuad.Centre + new Vector2(playfield.ScreenSpaceDrawQuad.Width * 0.20f, 0)));
+
+ AddStep("place second object", () => InputManager.Click(MouseButton.Left));
+
+ AddAssert("circle is at slider's end", () =>
+ {
+ var objects = EditorBeatmap.HitObjects;
+
+ var first = (Slider)objects.First();
+ var second = (OsuHitObject)objects.Last();
+
+ return Precision.AlmostEquals(first.EndPosition, second.Position);
+ });
+ }
+ }
+}
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneOsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs
similarity index 99%
rename from osu.Game.Rulesets.Osu.Tests/TestSceneOsuDistanceSnapGrid.cs
rename to osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs
index 0d0be2953b..1232369a0b 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneOsuDistanceSnapGrid.cs
+++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuDistanceSnapGrid.cs
@@ -19,7 +19,7 @@ using osu.Game.Tests.Visual;
using osuTK;
using osuTK.Graphics;
-namespace osu.Game.Rulesets.Osu.Tests
+namespace osu.Game.Rulesets.Osu.Tests.Editor
{
public class TestSceneOsuDistanceSnapGrid : OsuManualInputManagerTestScene
{
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneEditor.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditor.cs
similarity index 76%
rename from osu.Game.Rulesets.Osu.Tests/TestSceneEditor.cs
rename to osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditor.cs
index 9239034a53..e1ca3ddd61 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneEditor.cs
+++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneOsuEditor.cs
@@ -4,10 +4,10 @@
using NUnit.Framework;
using osu.Game.Tests.Visual;
-namespace osu.Game.Rulesets.Osu.Tests
+namespace osu.Game.Rulesets.Osu.Tests.Editor
{
[TestFixture]
- public class TestSceneEditor : EditorTestScene
+ public class TestSceneOsuEditor : EditorTestScene
{
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
}
diff --git a/osu.Game.Rulesets.Osu.Tests/TestScenePathControlPointVisualiser.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestScenePathControlPointVisualiser.cs
similarity index 97%
rename from osu.Game.Rulesets.Osu.Tests/TestScenePathControlPointVisualiser.cs
rename to osu.Game.Rulesets.Osu.Tests/Editor/TestScenePathControlPointVisualiser.cs
index 21fa283b6d..738a21b17e 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestScenePathControlPointVisualiser.cs
+++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestScenePathControlPointVisualiser.cs
@@ -12,7 +12,7 @@ using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Tests.Visual;
using osuTK;
-namespace osu.Game.Rulesets.Osu.Tests
+namespace osu.Game.Rulesets.Osu.Tests.Editor
{
public class TestScenePathControlPointVisualiser : OsuTestScene
{
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderPlacementBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderPlacementBlueprint.cs
similarity index 99%
rename from osu.Game.Rulesets.Osu.Tests/TestSceneSliderPlacementBlueprint.cs
rename to osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderPlacementBlueprint.cs
index fe9973f4d8..49d7d9249c 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderPlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderPlacementBlueprint.cs
@@ -14,7 +14,7 @@ using osu.Game.Tests.Visual;
using osuTK;
using osuTK.Input;
-namespace osu.Game.Rulesets.Osu.Tests
+namespace osu.Game.Rulesets.Osu.Tests.Editor
{
public class TestSceneSliderPlacementBlueprint : PlacementBlueprintTestScene
{
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSelectionBlueprint.cs
similarity index 99%
rename from osu.Game.Rulesets.Osu.Tests/TestSceneSliderSelectionBlueprint.cs
rename to osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSelectionBlueprint.cs
index d5be538d94..f6e1be693b 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneSliderSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSliderSelectionBlueprint.cs
@@ -16,7 +16,7 @@ using osu.Game.Tests.Visual;
using osuTK;
using osuTK.Input;
-namespace osu.Game.Rulesets.Osu.Tests
+namespace osu.Game.Rulesets.Osu.Tests.Editor
{
public class TestSceneSliderSelectionBlueprint : SelectionBlueprintTestScene
{
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerPlacementBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSpinnerPlacementBlueprint.cs
similarity index 94%
rename from osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerPlacementBlueprint.cs
rename to osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSpinnerPlacementBlueprint.cs
index d74d072857..fa6c660b01 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerPlacementBlueprint.cs
+++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSpinnerPlacementBlueprint.cs
@@ -9,7 +9,7 @@ using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
-namespace osu.Game.Rulesets.Osu.Tests
+namespace osu.Game.Rulesets.Osu.Tests.Editor
{
public class TestSceneSpinnerPlacementBlueprint : PlacementBlueprintTestScene
{
diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSpinnerSelectionBlueprint.cs
similarity index 96%
rename from osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerSelectionBlueprint.cs
rename to osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSpinnerSelectionBlueprint.cs
index 011463ab14..4248f68a60 100644
--- a/osu.Game.Rulesets.Osu.Tests/TestSceneSpinnerSelectionBlueprint.cs
+++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestSceneSpinnerSelectionBlueprint.cs
@@ -11,7 +11,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
using osuTK;
-namespace osu.Game.Rulesets.Osu.Tests
+namespace osu.Game.Rulesets.Osu.Tests.Editor
{
public class TestSceneSpinnerSelectionBlueprint : SelectionBlueprintTestScene
{
diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs
index e1cbfa93f6..912a705d16 100644
--- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs
+++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs
@@ -9,7 +9,9 @@ using osu.Framework.Bindables;
using osu.Framework.Caching;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
+using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Tools;
using osu.Game.Rulesets.Mods;
@@ -17,6 +19,7 @@ using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.UI;
+using osu.Game.Screens.Edit.Components.TernaryButtons;
using osu.Game.Screens.Edit.Compose.Components;
using osuTK;
@@ -39,12 +42,12 @@ namespace osu.Game.Rulesets.Osu.Edit
new SpinnerCompositionTool()
};
- private readonly BindableBool distanceSnapToggle = new BindableBool(true) { Description = "Distance Snap" };
+ private readonly Bindable distanceSnapToggle = new Bindable();
- protected override IEnumerable Toggles => new[]
+ protected override IEnumerable CreateTernaryButtons() => base.CreateTernaryButtons().Concat(new[]
{
- distanceSnapToggle
- };
+ new TernaryButton(distanceSnapToggle, "Distance Snap", () => new SpriteIcon { Icon = FontAwesome.Solid.Ruler })
+ });
private BindableList selectedHitObjects;
@@ -94,6 +97,10 @@ namespace osu.Game.Rulesets.Osu.Edit
public override SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition)
{
+ if (snapToVisibleBlueprints(screenSpacePosition, out var snapResult))
+ return snapResult;
+
+ // will be null if distance snap is disabled or not feasible for the current time value.
if (distanceSnapGrid == null)
return base.SnapScreenSpacePositionToValidTime(screenSpacePosition);
@@ -102,13 +109,57 @@ namespace osu.Game.Rulesets.Osu.Edit
return new SnapResult(distanceSnapGrid.ToScreenSpace(pos), time, PlayfieldAtScreenSpacePosition(screenSpacePosition));
}
+ private bool snapToVisibleBlueprints(Vector2 screenSpacePosition, out SnapResult snapResult)
+ {
+ // check other on-screen objects for snapping/stacking
+ var blueprints = BlueprintContainer.SelectionBlueprints.AliveChildren;
+
+ var playfield = PlayfieldAtScreenSpacePosition(screenSpacePosition);
+
+ float snapRadius =
+ playfield.GamefieldToScreenSpace(new Vector2(OsuHitObject.OBJECT_RADIUS / 5)).X -
+ playfield.GamefieldToScreenSpace(Vector2.Zero).X;
+
+ foreach (var b in blueprints)
+ {
+ if (b.IsSelected)
+ continue;
+
+ var hitObject = (OsuHitObject)b.HitObject;
+
+ Vector2? snap = checkSnap(hitObject.Position);
+ if (snap == null && hitObject.Position != hitObject.EndPosition)
+ snap = checkSnap(hitObject.EndPosition);
+
+ if (snap != null)
+ {
+ // only return distance portion, since time is not really valid
+ snapResult = new SnapResult(snap.Value, null, playfield);
+ return true;
+ }
+
+ Vector2? checkSnap(Vector2 checkPos)
+ {
+ Vector2 checkScreenPos = playfield.GamefieldToScreenSpace(checkPos);
+
+ if (Vector2.Distance(checkScreenPos, screenSpacePosition) < snapRadius)
+ return checkScreenPos;
+
+ return null;
+ }
+ }
+
+ snapResult = null;
+ return false;
+ }
+
private void updateDistanceSnapGrid()
{
distanceSnapGridContainer.Clear();
distanceSnapGridCache.Invalidate();
distanceSnapGrid = null;
- if (!distanceSnapToggle.Value)
+ if (distanceSnapToggle.Value != TernaryState.True)
return;
switch (BlueprintContainer.CurrentTool)
diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneEditor.cs b/osu.Game.Rulesets.Taiko.Tests/Editor/TestSceneEditor.cs
similarity index 88%
rename from osu.Game.Rulesets.Taiko.Tests/TestSceneEditor.cs
rename to osu.Game.Rulesets.Taiko.Tests/Editor/TestSceneEditor.cs
index 411fe08bcf..e3c1613bd9 100644
--- a/osu.Game.Rulesets.Taiko.Tests/TestSceneEditor.cs
+++ b/osu.Game.Rulesets.Taiko.Tests/Editor/TestSceneEditor.cs
@@ -4,7 +4,7 @@
using NUnit.Framework;
using osu.Game.Tests.Visual;
-namespace osu.Game.Rulesets.Taiko.Tests
+namespace osu.Game.Rulesets.Taiko.Tests.Editor
{
[TestFixture]
public class TestSceneEditor : EditorTestScene
diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoHitObjectComposer.cs b/osu.Game.Rulesets.Taiko.Tests/Editor/TestSceneTaikoHitObjectComposer.cs
similarity index 97%
rename from osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoHitObjectComposer.cs
rename to osu.Game.Rulesets.Taiko.Tests/Editor/TestSceneTaikoHitObjectComposer.cs
index 34d5fdf857..626537053a 100644
--- a/osu.Game.Rulesets.Taiko.Tests/TestSceneTaikoHitObjectComposer.cs
+++ b/osu.Game.Rulesets.Taiko.Tests/Editor/TestSceneTaikoHitObjectComposer.cs
@@ -12,7 +12,7 @@ using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Screens.Edit;
using osu.Game.Tests.Visual;
-namespace osu.Game.Rulesets.Taiko.Tests
+namespace osu.Game.Rulesets.Taiko.Tests.Editor
{
public class TestSceneTaikoHitObjectComposer : EditorClockTestScene
{
diff --git a/osu.Game.Rulesets.Taiko/Edit/TaikoSelectionHandler.cs b/osu.Game.Rulesets.Taiko/Edit/TaikoSelectionHandler.cs
index 40565048c2..a3ecf7ed95 100644
--- a/osu.Game.Rulesets.Taiko/Edit/TaikoSelectionHandler.cs
+++ b/osu.Game.Rulesets.Taiko/Edit/TaikoSelectionHandler.cs
@@ -1,9 +1,10 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using System;
using System.Collections.Generic;
using System.Linq;
+using osu.Framework.Allocation;
+using osu.Framework.Bindables;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Edit;
@@ -14,75 +15,80 @@ namespace osu.Game.Rulesets.Taiko.Edit
{
public class TaikoSelectionHandler : SelectionHandler
{
+ private readonly Bindable selectionRimState = new Bindable();
+ private readonly Bindable selectionStrongState = new Bindable();
+
+ [BackgroundDependencyLoader]
+ private void load()
+ {
+ selectionStrongState.ValueChanged += state =>
+ {
+ switch (state.NewValue)
+ {
+ case TernaryState.False:
+ SetStrongState(false);
+ break;
+
+ case TernaryState.True:
+ SetStrongState(true);
+ break;
+ }
+ };
+
+ selectionRimState.ValueChanged += state =>
+ {
+ switch (state.NewValue)
+ {
+ case TernaryState.False:
+ SetRimState(false);
+ break;
+
+ case TernaryState.True:
+ SetRimState(true);
+ break;
+ }
+ };
+ }
+
+ public void SetStrongState(bool state)
+ {
+ var hits = SelectedHitObjects.OfType();
+
+ ChangeHandler.BeginChange();
+
+ foreach (var h in hits)
+ h.IsStrong = state;
+
+ ChangeHandler.EndChange();
+ }
+
+ public void SetRimState(bool state)
+ {
+ var hits = SelectedHitObjects.OfType();
+
+ ChangeHandler.BeginChange();
+
+ foreach (var h in hits)
+ h.Type = state ? HitType.Rim : HitType.Centre;
+
+ ChangeHandler.EndChange();
+ }
+
protected override IEnumerable