diff --git a/Source/Editor/Surface/SurfaceNode.cs b/Source/Editor/Surface/SurfaceNode.cs
index 8a42a7a92..5dedd604f 100644
--- a/Source/Editor/Surface/SurfaceNode.cs
+++ b/Source/Editor/Surface/SurfaceNode.cs
@@ -912,7 +912,7 @@ namespace FlaxEditor.Surface
///
public override bool OnTestTooltipOverControl(ref Float2 location)
{
- return _headerRect.Contains(ref location) && ShowTooltip;
+ return _headerRect.Contains(ref location) && ShowTooltip && !Surface.IsConnecting && !Surface.IsBoxSelecting;
}
///
@@ -1070,7 +1070,7 @@ namespace FlaxEditor.Surface
// Header
var headerColor = style.BackgroundHighlighted;
- if (_headerRect.Contains(ref _mousePosition))
+ if (_headerRect.Contains(ref _mousePosition) && !Surface.IsConnecting && !Surface.IsBoxSelecting)
headerColor *= 1.07f;
Render2D.FillRectangle(_headerRect, headerColor);
Render2D.DrawText(style.FontLarge, Title, _headerRect, style.Foreground, TextAlignment.Center, TextAlignment.Center);
@@ -1078,7 +1078,8 @@ namespace FlaxEditor.Surface
// Close button
if ((Archetype.Flags & NodeFlags.NoCloseButton) == 0 && Surface.CanEdit)
{
- Render2D.DrawSprite(style.Cross, _closeButtonRect, _closeButtonRect.Contains(_mousePosition) ? style.Foreground : style.ForegroundGrey);
+ bool highlightClose = _closeButtonRect.Contains(_mousePosition) && !Surface.IsConnecting && !Surface.IsBoxSelecting;
+ Render2D.DrawSprite(style.Cross, _closeButtonRect, highlightClose ? style.Foreground : style.ForegroundGrey);
}
// Footer
@@ -1123,8 +1124,9 @@ namespace FlaxEditor.Surface
if (base.OnMouseUp(location, button))
return true;
- // Close
- if (button == MouseButton.Left && (Archetype.Flags & NodeFlags.NoCloseButton) == 0 && _closeButtonRect.Contains(ref location))
+ // Close/ delete
+ bool canDelete = !Surface.IsConnecting && !Surface.WasBoxSelecting && !Surface.WasMovingSelection;
+ if (button == MouseButton.Left && canDelete && (Archetype.Flags & NodeFlags.NoCloseButton) == 0 && _closeButtonRect.Contains(ref location))
{
Surface.Delete(this);
return true;
diff --git a/Source/Editor/Surface/VisjectSurface.Draw.cs b/Source/Editor/Surface/VisjectSurface.Draw.cs
index 5a63fe4de..01277d0d2 100644
--- a/Source/Editor/Surface/VisjectSurface.Draw.cs
+++ b/Source/Editor/Surface/VisjectSurface.Draw.cs
@@ -225,7 +225,7 @@ namespace FlaxEditor.Surface
_rootControl.DrawComments();
- if (IsSelecting)
+ if (IsBoxSelecting)
{
DrawSelection();
}
diff --git a/Source/Editor/Surface/VisjectSurface.Input.cs b/Source/Editor/Surface/VisjectSurface.Input.cs
index 09df195eb..63dfa063d 100644
--- a/Source/Editor/Surface/VisjectSurface.Input.cs
+++ b/Source/Editor/Surface/VisjectSurface.Input.cs
@@ -590,6 +590,9 @@ namespace FlaxEditor.Surface
// Cache flags and state
if (_leftMouseDown && button == MouseButton.Left)
{
+ WasBoxSelecting = IsBoxSelecting;
+ WasMovingSelection = _isMovingSelection;
+
_leftMouseDown = false;
EndMouseCapture();
Cursor = CursorType.Default;
diff --git a/Source/Editor/Surface/VisjectSurface.cs b/Source/Editor/Surface/VisjectSurface.cs
index 1683b6398..1201318d8 100644
--- a/Source/Editor/Surface/VisjectSurface.cs
+++ b/Source/Editor/Surface/VisjectSurface.cs
@@ -232,15 +232,25 @@ namespace FlaxEditor.Surface
}
///
- /// Gets a value indicating whether user is selecting nodes.
+ /// Gets a value indicating whether user is box selecting nodes.
///
- public bool IsSelecting => _leftMouseDown && !_isMovingSelection && _connectionInstigator == null;
+ public bool IsBoxSelecting => _leftMouseDown && !_isMovingSelection && _connectionInstigator == null;
+
+ ///
+ /// Gets a value indicating whether user was previously box selecting nodes.
+ ///
+ public bool WasBoxSelecting { get; private set; }
///
/// Gets a value indicating whether user is moving selected nodes.
///
public bool IsMovingSelection => _leftMouseDown && _isMovingSelection && _connectionInstigator == null;
+ ///
+ /// Gets a value indicating whether user was previously moving selected nodes.
+ ///
+ public bool WasMovingSelection { get; private set; }
+
///
/// Gets a value indicating whether user is connecting nodes.
///