Fix dragging existing connection

Undo stack
This commit is contained in:
stefnotch
2021-01-11 13:00:24 +01:00
parent 419ca4e630
commit 7112160de5
+14 -4
View File
@@ -97,7 +97,7 @@ namespace FlaxEditor.Surface.Elements
var connections = Connections.ToArray();
for (int i = 0; i < connections.Length; i++)
{
var targetBox = Connections[i];
var targetBox = connections[i];
// Break connection
Connections.Remove(targetBox);
@@ -568,9 +568,19 @@ namespace FlaxEditor.Surface.Elements
{
if (!IsOutput && HasSingleConnection)
{
var inputBox = Connections[0];
BreakConnection(inputBox);
Surface.ConnectingStart(inputBox);
var connectedBox = Connections[0];
if (Surface.Undo != null)
{
var action = new ConnectBoxesAction((InputBox)this, (OutputBox)connectedBox, false);
BreakConnection(connectedBox);
action.End();
Surface.Undo.AddAction(action);
}
else
{
BreakConnection(connectedBox);
}
Surface.ConnectingStart(connectedBox);
}
else
{