- Visual fix to preview connection when pulling out of an input box or a reroute node

This commit is contained in:
Nils Hausfeld
2023-10-06 18:16:04 +02:00
parent a9dd9adc22
commit 78c0e1dd92

View File

@@ -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);
}
/// <summary>