From 58998f4576881b46a81b1722f756a2731281c9cc Mon Sep 17 00:00:00 2001 From: Nils Hausfeld Date: Mon, 20 May 2024 21:18:12 +0200 Subject: [PATCH] - Reroute node now always checks if the mouse is inside the "connecting bounds" and changes the cursor accordingly - Slightly increased "connecting bounds" padding --- Source/Editor/Surface/Archetypes/Tools.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Source/Editor/Surface/Archetypes/Tools.cs b/Source/Editor/Surface/Archetypes/Tools.cs index 0340eee2f..7e5fc36db 100644 --- a/Source/Editor/Surface/Archetypes/Tools.cs +++ b/Source/Editor/Surface/Archetypes/Tools.cs @@ -1032,7 +1032,8 @@ namespace FlaxEditor.Surface.Archetypes private Rectangle _localBounds; private InputBox _input; private OutputBox _output; - private bool _isMouseDown, _isConnecting; + private bool _isMouseDown, _isConnecting, _isMouseInConnectingBounds; + private const float ConnectingBounds = -12.0f; /// public RerouteNode(uint id, VisjectSurfaceContext context, NodeArchetype nodeArch, GroupArchetype groupArch) @@ -1170,7 +1171,7 @@ namespace FlaxEditor.Surface.Archetypes if (button == MouseButton.Left) { _isMouseDown = true; - _isConnecting = _localBounds.MakeExpanded(-10.0f).Contains(ref location); // Inner area for connecting, outer area for moving + _isConnecting = _isMouseInConnectingBounds; if (_isConnecting) { Focus(); @@ -1189,12 +1190,22 @@ namespace FlaxEditor.Surface.Archetypes if (Surface.CanEdit && _isConnecting) Surface.ConnectingStart(this); } + + _isMouseInConnectingBounds = false; + Cursor = CursorType.Default; + base.OnMouseLeave(); } /// public override void OnMouseMove(Float2 location) { + _isMouseInConnectingBounds = IsMouseOver && _localBounds.MakeExpanded(ConnectingBounds).Contains(ref location); // Inner area for connecting, outer area for moving + if (!_isMouseInConnectingBounds && !_isMouseDown) + Cursor = CursorType.SizeAll; + else + Cursor = CursorType.Default; + Surface.ConnectingOver(this); base.OnMouseMove(location); }