Wire selection fixes:
- Fixed MathUtils.LineToPointDistance returning NaN if both points of the line are at the same position, preventing from selecting some wire nodes in the wiring mode. - Added an indicator that shows when a node is highlighted. - Wire nodes a higher preference for being highlighted than wire sections. Makes it easier to select nodes that are on top of another wire. Closes #215
This commit is contained in:
@@ -336,6 +336,11 @@ namespace Barotrauma
|
||||
float xDiff = lineB.X - lineA.X;
|
||||
float yDiff = lineB.Y - lineA.Y;
|
||||
|
||||
if (xDiff == 0 && yDiff == 0)
|
||||
{
|
||||
return Vector2.Distance(lineA, point);
|
||||
}
|
||||
|
||||
return (float)(Math.Abs(xDiff * (lineA.Y - point.Y) - yDiff * (lineA.X - point.X)) /
|
||||
Math.Sqrt(xDiff * xDiff + yDiff * yDiff));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user