Merge branch 'Visject-BendingPreviewConnectionFix' of https://github.com/Chikinsupu/FlaxEngine into Chikinsupu-Visject-BendingPreviewConnectionFix

This commit is contained in:
Wojtek Figat
2023-10-08 11:16:38 +02:00

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>