- Reroute node now always checks if the mouse is inside the "connecting bounds" and changes the cursor accordingly
- Slightly increased "connecting bounds" padding
This commit is contained in:
@@ -1032,7 +1032,8 @@ namespace FlaxEditor.Surface.Archetypes
|
|||||||
private Rectangle _localBounds;
|
private Rectangle _localBounds;
|
||||||
private InputBox _input;
|
private InputBox _input;
|
||||||
private OutputBox _output;
|
private OutputBox _output;
|
||||||
private bool _isMouseDown, _isConnecting;
|
private bool _isMouseDown, _isConnecting, _isMouseInConnectingBounds;
|
||||||
|
private const float ConnectingBounds = -12.0f;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public RerouteNode(uint id, VisjectSurfaceContext context, NodeArchetype nodeArch, GroupArchetype groupArch)
|
public RerouteNode(uint id, VisjectSurfaceContext context, NodeArchetype nodeArch, GroupArchetype groupArch)
|
||||||
@@ -1170,7 +1171,7 @@ namespace FlaxEditor.Surface.Archetypes
|
|||||||
if (button == MouseButton.Left)
|
if (button == MouseButton.Left)
|
||||||
{
|
{
|
||||||
_isMouseDown = true;
|
_isMouseDown = true;
|
||||||
_isConnecting = _localBounds.MakeExpanded(-10.0f).Contains(ref location); // Inner area for connecting, outer area for moving
|
_isConnecting = _isMouseInConnectingBounds;
|
||||||
if (_isConnecting)
|
if (_isConnecting)
|
||||||
{
|
{
|
||||||
Focus();
|
Focus();
|
||||||
@@ -1189,12 +1190,22 @@ namespace FlaxEditor.Surface.Archetypes
|
|||||||
if (Surface.CanEdit && _isConnecting)
|
if (Surface.CanEdit && _isConnecting)
|
||||||
Surface.ConnectingStart(this);
|
Surface.ConnectingStart(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_isMouseInConnectingBounds = false;
|
||||||
|
Cursor = CursorType.Default;
|
||||||
|
|
||||||
base.OnMouseLeave();
|
base.OnMouseLeave();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnMouseMove(Float2 location)
|
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);
|
Surface.ConnectingOver(this);
|
||||||
base.OnMouseMove(location);
|
base.OnMouseMove(location);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user