1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 19:27:24 +08:00

Apply suggestions and remove redundant updateConnectingPath call

This commit is contained in:
kamp 2020-11-17 22:23:46 +01:00
parent c6618f08aa
commit c8fb49d540
2 changed files with 5 additions and 17 deletions

View File

@ -20,17 +20,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
private readonly Path path;
private readonly Slider slider;
private int controlPointIndex;
public int ControlPointIndex
{
get => controlPointIndex;
set
{
controlPointIndex = value;
updateConnectingPath();
}
}
public int ControlPointIndex { get; set; }
private IBindable<Vector2> sliderPosition;
private IBindable<int> pathVersion;
@ -38,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
public PathControlPointConnectionPiece(Slider slider, int controlPointIndex)
{
this.slider = slider;
this.controlPointIndex = controlPointIndex;
ControlPointIndex = controlPointIndex;
Origin = Anchor.Centre;
AutoSizeAxes = Axes.Both;
@ -74,7 +64,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
path.ClearVertices();
int nextIndex = controlPointIndex + 1;
int nextIndex = ControlPointIndex + 1;
if (nextIndex == 0 || nextIndex >= slider.Path.ControlPoints.Count)
return;

View File

@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
switch (e.Action)
{
case NotifyCollectionChangedAction.Add:
// If inserting in the the path (not appending),
// If inserting in the path (not appending),
// update indices of existing connections after insert location
if (e.NewStartingIndex < Pieces.Count)
{
@ -93,8 +93,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
break;
case NotifyCollectionChangedAction.Remove:
int oldSize = Pieces.Count;
foreach (var point in e.OldItems.Cast<PathControlPoint>())
{
Pieces.RemoveAll(p => p.ControlPoint == point);
@ -103,7 +101,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
// If removing before the end of the path,
// update indices of connections after remove location
if (e.OldStartingIndex + e.OldItems.Count < oldSize)
if (e.OldStartingIndex + e.OldItems.Count < Pieces.Count + e.OldItems.Count)
{
foreach (var connection in Connections)
{