diff --git a/Source/Editor/Surface/VisjectSurface.Connecting.cs b/Source/Editor/Surface/VisjectSurface.Connecting.cs index d733c7a0e..9b5ce1cf8 100644 --- a/Source/Editor/Surface/VisjectSurface.Connecting.cs +++ b/Source/Editor/Surface/VisjectSurface.Connecting.cs @@ -237,12 +237,12 @@ namespace FlaxEditor.Surface /// If the instigator should be added to the list of instigators. public void ConnectingStart(IConnectionInstigator instigator, bool additive = false) { - if (instigator != null && instigator != _connectionInstigator) + if (instigator != null && instigator != _connectionInstigators) { if (!additive) - _connectionInstigator.Clear(); + _connectionInstigators.Clear(); - _connectionInstigator.Add(instigator); + _connectionInstigators.Add(instigator); StartMouseCapture(); } } @@ -263,13 +263,13 @@ namespace FlaxEditor.Surface public void ConnectingEnd(IConnectionInstigator end) { // Ensure that there is at least one connection instigator - if (_connectionInstigator.Count == 0) + if (_connectionInstigators.Count == 0) return; - List instigators = new List(_connectionInstigator); + List instigators = new List(_connectionInstigators); for (int i = 0; i < instigators.Count; i++) { - var start = _connectionInstigator[i]; + var start = _connectionInstigators[i]; // Check if boxes are different and end box is specified if (start == end || end == null) @@ -281,7 +281,7 @@ namespace FlaxEditor.Surface } // Reset instigator list - _connectionInstigator.Clear(); + _connectionInstigators.Clear(); } } } diff --git a/Source/Editor/Surface/VisjectSurface.ContextMenu.cs b/Source/Editor/Surface/VisjectSurface.ContextMenu.cs index 98221ce6f..36ef020d3 100644 --- a/Source/Editor/Surface/VisjectSurface.ContextMenu.cs +++ b/Source/Editor/Surface/VisjectSurface.ContextMenu.cs @@ -290,7 +290,8 @@ namespace FlaxEditor.Surface _cmStartPos = location; // Offset added in case the user doesn't like the box and wants to quickly get rid of it by clicking - OnShowPrimaryMenu(_activeVisjectCM, _cmStartPos + ContextMenuOffset, _connectionInstigator[0] as Box); + Box startBox = _connectionInstigators.Count > 0 ? _connectionInstigators[0] as Box : null; + OnShowPrimaryMenu(_activeVisjectCM, _cmStartPos + ContextMenuOffset, startBox); if (!string.IsNullOrEmpty(input)) { @@ -475,7 +476,7 @@ namespace FlaxEditor.Surface private void OnPrimaryMenuVisibleChanged(Control primaryMenu) { if (!primaryMenu.Visible) - _connectionInstigator.Clear(); + _connectionInstigators.Clear(); } /// @@ -553,7 +554,7 @@ namespace FlaxEditor.Surface } // If the user is patiently waiting for his box to get connected to the newly created one fulfill his wish! - _connectionInstigator[0] = startBox; + _connectionInstigators[0] = startBox; if (!IsConnecting) { diff --git a/Source/Editor/Surface/VisjectSurface.Draw.cs b/Source/Editor/Surface/VisjectSurface.Draw.cs index dcf5e8108..5f8a7284a 100644 --- a/Source/Editor/Surface/VisjectSurface.Draw.cs +++ b/Source/Editor/Surface/VisjectSurface.Draw.cs @@ -131,7 +131,7 @@ namespace FlaxEditor.Surface var endPos = cmVisible ? _rootControl.PointFromParent(ref _cmStartPos) : _rootControl.PointFromParent(ref _mousePos); Color lineColor = Style.Colors.Connecting; - List instigators = new List(_connectionInstigator); + List instigators = new List(_connectionInstigators); for (int i = 0; i < instigators.Count; i++) { IConnectionInstigator currentInstigator = instigators[i]; diff --git a/Source/Editor/Surface/VisjectSurface.Input.cs b/Source/Editor/Surface/VisjectSurface.Input.cs index 25fdfe7e4..dda112b20 100644 --- a/Source/Editor/Surface/VisjectSurface.Input.cs +++ b/Source/Editor/Surface/VisjectSurface.Input.cs @@ -268,7 +268,7 @@ namespace FlaxEditor.Surface if (_leftMouseDown) { // Connecting - if (_connectionInstigator.Count > 0) + if (_connectionInstigators.Count > 0) { } // Moving @@ -438,7 +438,7 @@ namespace FlaxEditor.Surface public override bool OnMouseDown(Float2 location, MouseButton button) { // Check if user is connecting boxes - if (_connectionInstigator.Count > 0) + if (_connectionInstigators.Count > 0) return true; // Base @@ -560,7 +560,7 @@ namespace FlaxEditor.Surface _movingNodesDelta = Float2.Zero; } // Connecting - else if (_connectionInstigator.Count > 0) + else if (_connectionInstigators.Count > 0) { } // Selecting @@ -632,7 +632,7 @@ namespace FlaxEditor.Surface ShowPrimaryMenu(_cmStartPos); } // Letting go of a connection or right clicking while creating a connection - else if (!_isMovingSelection && _connectionInstigator.Count > 0 && !IsPrimaryMenuOpened) + else if (!_isMovingSelection && _connectionInstigators.Count > 0 && !IsPrimaryMenuOpened) { _cmStartPos = location; Cursor = CursorType.Default; diff --git a/Source/Editor/Surface/VisjectSurface.Serialization.cs b/Source/Editor/Surface/VisjectSurface.Serialization.cs index cf5af9a4f..5bf7a9e34 100644 --- a/Source/Editor/Surface/VisjectSurface.Serialization.cs +++ b/Source/Editor/Surface/VisjectSurface.Serialization.cs @@ -33,7 +33,7 @@ namespace FlaxEditor.Surface Enabled = false; // Clean data - _connectionInstigator.Clear(); + _connectionInstigators.Clear(); _lastInstigatorUnderMouse = null; var failed = RootContext.Load(); diff --git a/Source/Editor/Surface/VisjectSurface.cs b/Source/Editor/Surface/VisjectSurface.cs index 19413ad48..f886682e4 100644 --- a/Source/Editor/Surface/VisjectSurface.cs +++ b/Source/Editor/Surface/VisjectSurface.cs @@ -121,7 +121,7 @@ namespace FlaxEditor.Surface /// /// The connection start. /// - protected List _connectionInstigator = new List(); + protected List _connectionInstigators = new List(); /// /// The last connection instigator under mouse. @@ -234,17 +234,17 @@ namespace FlaxEditor.Surface /// /// Gets a value indicating whether user is selecting nodes. /// - public bool IsSelecting => _leftMouseDown && !_isMovingSelection && _connectionInstigator.Count == 0; + public bool IsSelecting => _leftMouseDown && !_isMovingSelection && _connectionInstigators.Count == 0; /// /// Gets a value indicating whether user is moving selected nodes. /// - public bool IsMovingSelection => _leftMouseDown && _isMovingSelection && _connectionInstigator.Count == 0; + public bool IsMovingSelection => _leftMouseDown && _isMovingSelection && _connectionInstigators.Count == 0; /// /// Gets a value indicating whether user is connecting nodes. /// - public bool IsConnecting => _connectionInstigator.Count > 0; + public bool IsConnecting => _connectionInstigators.Count > 0; /// /// Gets a value indicating whether the left mouse button is down.