fixes
This commit is contained in:
@@ -237,12 +237,12 @@ namespace FlaxEditor.Surface
|
|||||||
/// <param name="additive">If the instigator should be added to the list of instigators.</param>
|
/// <param name="additive">If the instigator should be added to the list of instigators.</param>
|
||||||
public void ConnectingStart(IConnectionInstigator instigator, bool additive = false)
|
public void ConnectingStart(IConnectionInstigator instigator, bool additive = false)
|
||||||
{
|
{
|
||||||
if (instigator != null && instigator != _connectionInstigator)
|
if (instigator != null && instigator != _connectionInstigators)
|
||||||
{
|
{
|
||||||
if (!additive)
|
if (!additive)
|
||||||
_connectionInstigator.Clear();
|
_connectionInstigators.Clear();
|
||||||
|
|
||||||
_connectionInstigator.Add(instigator);
|
_connectionInstigators.Add(instigator);
|
||||||
StartMouseCapture();
|
StartMouseCapture();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -263,13 +263,13 @@ namespace FlaxEditor.Surface
|
|||||||
public void ConnectingEnd(IConnectionInstigator end)
|
public void ConnectingEnd(IConnectionInstigator end)
|
||||||
{
|
{
|
||||||
// Ensure that there is at least one connection instigator
|
// Ensure that there is at least one connection instigator
|
||||||
if (_connectionInstigator.Count == 0)
|
if (_connectionInstigators.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
List<IConnectionInstigator> instigators = new List<IConnectionInstigator>(_connectionInstigator);
|
List<IConnectionInstigator> instigators = new List<IConnectionInstigator>(_connectionInstigators);
|
||||||
for (int i = 0; i < instigators.Count; i++)
|
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
|
// Check if boxes are different and end box is specified
|
||||||
if (start == end || end == null)
|
if (start == end || end == null)
|
||||||
@@ -281,7 +281,7 @@ namespace FlaxEditor.Surface
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reset instigator list
|
// Reset instigator list
|
||||||
_connectionInstigator.Clear();
|
_connectionInstigators.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -290,7 +290,8 @@ namespace FlaxEditor.Surface
|
|||||||
_cmStartPos = location;
|
_cmStartPos = location;
|
||||||
|
|
||||||
// Offset added in case the user doesn't like the box and wants to quickly get rid of it by clicking
|
// 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))
|
if (!string.IsNullOrEmpty(input))
|
||||||
{
|
{
|
||||||
@@ -475,7 +476,7 @@ namespace FlaxEditor.Surface
|
|||||||
private void OnPrimaryMenuVisibleChanged(Control primaryMenu)
|
private void OnPrimaryMenuVisibleChanged(Control primaryMenu)
|
||||||
{
|
{
|
||||||
if (!primaryMenu.Visible)
|
if (!primaryMenu.Visible)
|
||||||
_connectionInstigator.Clear();
|
_connectionInstigators.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -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!
|
// 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)
|
if (!IsConnecting)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ namespace FlaxEditor.Surface
|
|||||||
var endPos = cmVisible ? _rootControl.PointFromParent(ref _cmStartPos) : _rootControl.PointFromParent(ref _mousePos);
|
var endPos = cmVisible ? _rootControl.PointFromParent(ref _cmStartPos) : _rootControl.PointFromParent(ref _mousePos);
|
||||||
Color lineColor = Style.Colors.Connecting;
|
Color lineColor = Style.Colors.Connecting;
|
||||||
|
|
||||||
List<IConnectionInstigator> instigators = new List<IConnectionInstigator>(_connectionInstigator);
|
List<IConnectionInstigator> instigators = new List<IConnectionInstigator>(_connectionInstigators);
|
||||||
for (int i = 0; i < instigators.Count; i++)
|
for (int i = 0; i < instigators.Count; i++)
|
||||||
{
|
{
|
||||||
IConnectionInstigator currentInstigator = instigators[i];
|
IConnectionInstigator currentInstigator = instigators[i];
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ namespace FlaxEditor.Surface
|
|||||||
if (_leftMouseDown)
|
if (_leftMouseDown)
|
||||||
{
|
{
|
||||||
// Connecting
|
// Connecting
|
||||||
if (_connectionInstigator.Count > 0)
|
if (_connectionInstigators.Count > 0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
// Moving
|
// Moving
|
||||||
@@ -438,7 +438,7 @@ namespace FlaxEditor.Surface
|
|||||||
public override bool OnMouseDown(Float2 location, MouseButton button)
|
public override bool OnMouseDown(Float2 location, MouseButton button)
|
||||||
{
|
{
|
||||||
// Check if user is connecting boxes
|
// Check if user is connecting boxes
|
||||||
if (_connectionInstigator.Count > 0)
|
if (_connectionInstigators.Count > 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Base
|
// Base
|
||||||
@@ -560,7 +560,7 @@ namespace FlaxEditor.Surface
|
|||||||
_movingNodesDelta = Float2.Zero;
|
_movingNodesDelta = Float2.Zero;
|
||||||
}
|
}
|
||||||
// Connecting
|
// Connecting
|
||||||
else if (_connectionInstigator.Count > 0)
|
else if (_connectionInstigators.Count > 0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
// Selecting
|
// Selecting
|
||||||
@@ -632,7 +632,7 @@ namespace FlaxEditor.Surface
|
|||||||
ShowPrimaryMenu(_cmStartPos);
|
ShowPrimaryMenu(_cmStartPos);
|
||||||
}
|
}
|
||||||
// Letting go of a connection or right clicking while creating a connection
|
// 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;
|
_cmStartPos = location;
|
||||||
Cursor = CursorType.Default;
|
Cursor = CursorType.Default;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace FlaxEditor.Surface
|
|||||||
Enabled = false;
|
Enabled = false;
|
||||||
|
|
||||||
// Clean data
|
// Clean data
|
||||||
_connectionInstigator.Clear();
|
_connectionInstigators.Clear();
|
||||||
_lastInstigatorUnderMouse = null;
|
_lastInstigatorUnderMouse = null;
|
||||||
|
|
||||||
var failed = RootContext.Load();
|
var failed = RootContext.Load();
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ namespace FlaxEditor.Surface
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The connection start.
|
/// The connection start.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected List<IConnectionInstigator> _connectionInstigator = new List<IConnectionInstigator>();
|
protected List<IConnectionInstigator> _connectionInstigators = new List<IConnectionInstigator>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The last connection instigator under mouse.
|
/// The last connection instigator under mouse.
|
||||||
@@ -234,17 +234,17 @@ namespace FlaxEditor.Surface
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether user is selecting nodes.
|
/// Gets a value indicating whether user is selecting nodes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsSelecting => _leftMouseDown && !_isMovingSelection && _connectionInstigator.Count == 0;
|
public bool IsSelecting => _leftMouseDown && !_isMovingSelection && _connectionInstigators.Count == 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether user is moving selected nodes.
|
/// Gets a value indicating whether user is moving selected nodes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsMovingSelection => _leftMouseDown && _isMovingSelection && _connectionInstigator.Count == 0;
|
public bool IsMovingSelection => _leftMouseDown && _isMovingSelection && _connectionInstigators.Count == 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether user is connecting nodes.
|
/// Gets a value indicating whether user is connecting nodes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsConnecting => _connectionInstigator.Count > 0;
|
public bool IsConnecting => _connectionInstigators.Count > 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether the left mouse button is down.
|
/// Gets a value indicating whether the left mouse button is down.
|
||||||
|
|||||||
Reference in New Issue
Block a user