diff --git a/osu.Game.Rulesets.Osu.Tests/Editor/TestScenePathControlPointVisualiser.cs b/osu.Game.Rulesets.Osu.Tests/Editor/TestScenePathControlPointVisualiser.cs
index 0ca30e00bc..9af028fd8c 100644
--- a/osu.Game.Rulesets.Osu.Tests/Editor/TestScenePathControlPointVisualiser.cs
+++ b/osu.Game.Rulesets.Osu.Tests/Editor/TestScenePathControlPointVisualiser.cs
@@ -30,23 +30,6 @@ public void Setup() => Schedule(() =>
slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
});
- [Test]
- public void TestAddOverlappingControlPoints()
- {
- createVisualiser(true);
-
- addControlPointStep(new Vector2(200));
- addControlPointStep(new Vector2(300));
- addControlPointStep(new Vector2(300));
- addControlPointStep(new Vector2(500, 300));
-
- AddAssert("last connection displayed", () =>
- {
- var lastConnection = visualiser.Connections.Last(c => c.ControlPoint.Position == new Vector2(300));
- return lastConnection.DrawWidth > 50;
- });
- }
-
[Test]
public void TestPerfectCurveTooManyPoints()
{
@@ -194,24 +177,6 @@ public void TestStackingUpdatesPointsPosition()
addAssertPointPositionChanged(points, i);
}
- [Test]
- public void TestStackingUpdatesConnectionPosition()
- {
- createVisualiser(true);
-
- Vector2 connectionPosition;
- addControlPointStep(connectionPosition = new Vector2(300));
- addControlPointStep(new Vector2(600));
-
- // Apply a big number in stacking so the person running the test can clearly see if it fails
- AddStep("apply stacking", () => slider.StackHeightBindable.Value += 10);
-
- AddAssert($"Connection at {connectionPosition} changed",
- () => visualiser.Connections[0].Position,
- () => !Is.EqualTo(connectionPosition)
- );
- }
-
private void addAssertPointPositionChanged(Vector2[] points, int index)
{
AddAssert($"Point at {points.ElementAt(index)} changed",
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointConnectionPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointConnection.cs
similarity index 51%
rename from osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointConnectionPiece.cs
rename to osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointConnection.cs
index 9b3d8fc7a7..5706ed4baf 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointConnectionPiece.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointConnection.cs
@@ -4,10 +4,7 @@
#nullable disable
using osu.Framework.Bindables;
-using osu.Framework.Graphics;
-using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Lines;
-using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Objects;
using osuTK;
@@ -15,36 +12,21 @@
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
{
///
- /// A visualisation of the line between two s.
+ /// A visualisation of the lines between s.
///
- /// The type of which this visualises.
- public partial class PathControlPointConnectionPiece : CompositeDrawable where T : OsuHitObject, IHasPath
+ /// The type of which this visualises.
+ public partial class PathControlPointConnection : SmoothPath where T : OsuHitObject, IHasPath
{
- public readonly PathControlPoint ControlPoint;
-
- private readonly Path path;
private readonly T hitObject;
- public int ControlPointIndex { get; set; }
private IBindable hitObjectPosition;
private IBindable pathVersion;
private IBindable stackHeight;
- public PathControlPointConnectionPiece(T hitObject, int controlPointIndex)
+ public PathControlPointConnection(T hitObject)
{
this.hitObject = hitObject;
- ControlPointIndex = controlPointIndex;
-
- Origin = Anchor.Centre;
- AutoSizeAxes = Axes.Both;
-
- ControlPoint = hitObject.Path.ControlPoints[controlPointIndex];
-
- InternalChild = path = new SmoothPath
- {
- Anchor = Anchor.Centre,
- PathRadius = 1
- };
+ PathRadius = 1;
}
protected override void LoadComplete()
@@ -68,18 +50,14 @@ protected override void LoadComplete()
///
private void updateConnectingPath()
{
- Position = hitObject.StackedPosition + ControlPoint.Position;
+ Position = hitObject.StackedPosition;
- path.ClearVertices();
+ ClearVertices();
- int nextIndex = ControlPointIndex + 1;
- if (nextIndex == 0 || nextIndex >= hitObject.Path.ControlPoints.Count)
- return;
+ foreach (var controlPoint in hitObject.Path.ControlPoints)
+ AddVertex(controlPoint.Position);
- path.AddVertex(Vector2.Zero);
- path.AddVertex(hitObject.Path.ControlPoints[nextIndex].Position - ControlPoint.Position);
-
- path.OriginPosition = path.PositionInBoundingBox(Vector2.Zero);
+ OriginPosition = PositionInBoundingBox(Vector2.Zero);
}
}
}
diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
index b2d1709531..7212de322d 100644
--- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
+++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs
@@ -37,7 +37,6 @@ public partial class PathControlPointVisualiser : CompositeDrawable, IKeyBind
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; // allow context menu to appear outside of the playfield.
internal readonly Container> Pieces;
- internal readonly Container> Connections;
private readonly IBindableList controlPoints = new BindableList();
private readonly T hitObject;
@@ -63,7 +62,7 @@ public PathControlPointVisualiser(T hitObject, bool allowSelection)
InternalChildren = new Drawable[]
{
- Connections = new Container> { RelativeSizeAxes = Axes.Both },
+ new PathControlPointConnection(hitObject),
Pieces = new Container> { RelativeSizeAxes = Axes.Both }
};
}
@@ -185,17 +184,6 @@ private void onControlPointsChanged(object sender, NotifyCollectionChangedEventA
case NotifyCollectionChangedAction.Add:
Debug.Assert(e.NewItems != null);
- // If inserting in the path (not appending),
- // update indices of existing connections after insert location
- if (e.NewStartingIndex < Pieces.Count)
- {
- foreach (var connection in Connections)
- {
- if (connection.ControlPointIndex >= e.NewStartingIndex)
- connection.ControlPointIndex += e.NewItems.Count;
- }
- }
-
for (int i = 0; i < e.NewItems.Count; i++)
{
var point = (PathControlPoint)e.NewItems[i];
@@ -209,8 +197,6 @@ private void onControlPointsChanged(object sender, NotifyCollectionChangedEventA
d.DragInProgress = DragInProgress;
d.DragEnded = DragEnded;
}));
-
- Connections.Add(new PathControlPointConnectionPiece(hitObject, e.NewStartingIndex + i));
}
break;
@@ -222,19 +208,6 @@ private void onControlPointsChanged(object sender, NotifyCollectionChangedEventA
{
foreach (var piece in Pieces.Where(p => p.ControlPoint == point).ToArray())
piece.RemoveAndDisposeImmediately();
- foreach (var connection in Connections.Where(c => c.ControlPoint == point).ToArray())
- connection.RemoveAndDisposeImmediately();
- }
-
- // If removing before the end of the path,
- // update indices of connections after remove location
- if (e.OldStartingIndex < Pieces.Count)
- {
- foreach (var connection in Connections)
- {
- if (connection.ControlPointIndex >= e.OldStartingIndex)
- connection.ControlPointIndex -= e.OldItems.Count;
- }
}
break;