mirror of
https://github.com/ppy/osu
synced 2025-03-02 09:30:57 +00:00
Apply suggestions and remove redundant updateConnectingPath call
This commit is contained in:
parent
c6618f08aa
commit
c8fb49d540
@ -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;
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user