diff --git a/Source/Editor/Surface/VisjectSurface.Draw.cs b/Source/Editor/Surface/VisjectSurface.Draw.cs index 8db64b476..6180cfa12 100644 --- a/Source/Editor/Surface/VisjectSurface.Draw.cs +++ b/Source/Editor/Surface/VisjectSurface.Draw.cs @@ -1,5 +1,6 @@ // Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. +using FlaxEditor.Surface.Elements; using FlaxEngine; namespace FlaxEditor.Surface @@ -135,8 +136,25 @@ namespace FlaxEditor.Surface endPos = _lastInstigatorUnderMouse.ConnectionOrigin; } + Float2 actualStartPos = startPos; + Float2 actualEndPos = endPos; + + if (_connectionInstigator is Archetypes.Tools.RerouteNode) + { + if (endPos.X < startPos.X && _lastInstigatorUnderMouse is null or Box { IsOutput: true}) + { + actualStartPos = endPos; + actualEndPos = startPos; + } + } + else if (_connectionInstigator is Box { IsOutput: false }) + { + actualStartPos = endPos; + actualEndPos = startPos; + } + // Draw connection - _connectionInstigator.DrawConnectingLine(ref startPos, ref endPos, ref lineColor); + _connectionInstigator.DrawConnectingLine(ref actualStartPos, ref actualEndPos, ref lineColor); } ///