From 78c0e1dd925edb8733ffd9457f94f0e45378c9c9 Mon Sep 17 00:00:00 2001 From: Nils Hausfeld Date: Fri, 6 Oct 2023 18:16:04 +0200 Subject: [PATCH] - Visual fix to preview connection when pulling out of an input box or a reroute node --- Source/Editor/Surface/VisjectSurface.Draw.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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); } ///