From f3e6b74043d7bfdd636a2ea5f9e540e278975d60 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 21 Feb 2024 09:12:31 +0100 Subject: [PATCH] Add breaking node connection under mouse with middle button click #1010 --- Source/Editor/Surface/VisjectSurface.Input.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Source/Editor/Surface/VisjectSurface.Input.cs b/Source/Editor/Surface/VisjectSurface.Input.cs index 419c2d468..356e798fa 100644 --- a/Source/Editor/Surface/VisjectSurface.Input.cs +++ b/Source/Editor/Surface/VisjectSurface.Input.cs @@ -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