mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 14:32:55 +08:00
Use the more consistent lastVertex
, with a comment
This commit is contained in:
parent
d49d303bae
commit
4509c8bcfb
@ -9,7 +9,11 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components
|
|||||||
{
|
{
|
||||||
public class PlacementEditablePath : EditablePath
|
public class PlacementEditablePath : EditablePath
|
||||||
{
|
{
|
||||||
private JuiceStreamPathVertex originalNewVertex;
|
/// <summary>
|
||||||
|
/// The original position of the last added vertex.
|
||||||
|
/// This is not same as the last vertex of the current path because the vertex ordering can change.
|
||||||
|
/// </summary>
|
||||||
|
private JuiceStreamPathVertex lastVertex;
|
||||||
|
|
||||||
public PlacementEditablePath(Func<float, double> positionToDistance)
|
public PlacementEditablePath(Func<float, double> positionToDistance)
|
||||||
: base(positionToDistance)
|
: base(positionToDistance)
|
||||||
@ -27,7 +31,7 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components
|
|||||||
VertexStates[i].VertexBeforeChange = Vertices[i];
|
VertexStates[i].VertexBeforeChange = Vertices[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
originalNewVertex = Vertices[index];
|
lastVertex = Vertices[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -36,8 +40,8 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components
|
|||||||
public void MoveLastVertex(Vector2 screenSpacePosition)
|
public void MoveLastVertex(Vector2 screenSpacePosition)
|
||||||
{
|
{
|
||||||
Vector2 position = ToRelativePosition(screenSpacePosition);
|
Vector2 position = ToRelativePosition(screenSpacePosition);
|
||||||
double distanceDelta = PositionToDistance(position.Y) - originalNewVertex.Distance;
|
double distanceDelta = PositionToDistance(position.Y) - lastVertex.Distance;
|
||||||
float xDelta = position.X - originalNewVertex.X;
|
float xDelta = position.X - lastVertex.X;
|
||||||
MoveSelectedVertices(distanceDelta, xDelta);
|
MoveSelectedVertices(distanceDelta, xDelta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user