Improved wire editing logic:

- wires have to be selected by clicking before any nodes can be moved
- wires can be selected by clicking either the nodes or the sections
- new nodes can be added by clicking a section while holding ctrl
- the selected wire is drawn on top of all other entities
This commit is contained in:
Regalis
2016-11-30 16:45:21 +02:00
parent 2e2c206d5f
commit 568c909ff0
3 changed files with 195 additions and 54 deletions
+5 -2
View File
@@ -235,8 +235,11 @@ namespace Barotrauma
public static float LineToPointDistance(Vector2 lineA, Vector2 lineB, Vector2 point)
{
return (float)(Math.Abs((lineB.X-lineA.X)*(lineA.Y - point.Y) - (lineA.X - point.X)*(lineB.Y-lineA.Y)) /
Math.Sqrt(Math.Pow(lineB.X - lineA.X, 2) + Math.Pow(lineB.Y - lineA.Y, 2)));
float xDiff = lineB.X - lineA.X;
float yDiff = lineB.Y - lineA.Y;
return (float)(Math.Abs(xDiff * (lineA.Y - point.Y) - yDiff * (lineA.X - point.X)) /
Math.Sqrt(xDiff * xDiff + yDiff * yDiff));
}
public static bool CircleIntersectsRectangle(Vector2 circlePos, float radius, Rectangle rect)