Skip to content

Commit

Permalink
fix my fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ChromaCat248 committed Dec 5, 2023
1 parent b08df98 commit 68f1891
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Fushigi/ui/SceneObjects/bgunit/BGUnitRailSceneObj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,10 @@ public void OnMouseDown(CourseAreaEditContext ctx, LevelViewport viewport)

int segmentCount = rail.Points.Count;

if (!rail.IsClosed)
if (!rail.IsClosed && rail.Points.Any())
{
segmentCount--;
var delta = rail.Points.Any() ?
Vector3.Distance(rail.Points[0].Position, pos):
0;
var delta = Vector3.Distance(rail.Points[0].Position, pos);
if (delta < min.delta)
min = (delta, 1);
}
Expand All @@ -188,7 +186,7 @@ public void OnMouseDown(CourseAreaEditContext ctx, LevelViewport viewport)
}

DeselectAll(ctx);
InsertPoint(ctx, new BGUnitRail.RailPoint(rail, pos), rail.Points.Count);
InsertPoint(ctx, new BGUnitRail.RailPoint(rail, pos), min.index);
}
else
{
Expand Down

0 comments on commit 68f1891

Please sign in to comment.