Add breaking node connection under mouse with middle button click

#1010
This commit is contained in:
Wojtek Figat
2024-02-21 09:12:31 +01:00
parent 97cb8d1b61
commit f3e6b74043

View File

@@ -557,7 +557,21 @@ namespace FlaxEditor.Surface
_middleMouseDown = false;
EndMouseCapture();
Cursor = CursorType.Default;
_mouseMoveAmount = 0;
if (_mouseMoveAmount > 0)
_mouseMoveAmount = 0;
else if (CanEdit)
{
// Surface was not moved with MMB so try to remove connection underneath
var mousePos = _rootControl.PointFromParent(ref location);
if (IntersectsConnection(mousePos, out InputBox inputBox, out OutputBox outputBox))
{
var action = new EditNodeConnections(inputBox.ParentNode.Context, inputBox.ParentNode);
inputBox.BreakConnection(outputBox);
action.End();
AddBatchedUndoAction(action);
MarkAsEdited();
}
}
}
// Base