Merge branch 'xxSeys1-VisjectCloseButtonFix'
This commit is contained in:
@@ -912,7 +912,7 @@ namespace FlaxEditor.Surface
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool OnTestTooltipOverControl(ref Float2 location)
|
public override bool OnTestTooltipOverControl(ref Float2 location)
|
||||||
{
|
{
|
||||||
return _headerRect.Contains(ref location) && ShowTooltip;
|
return _headerRect.Contains(ref location) && ShowTooltip && !Surface.IsConnecting && !Surface.IsBoxSelecting;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -1070,7 +1070,7 @@ namespace FlaxEditor.Surface
|
|||||||
|
|
||||||
// Header
|
// Header
|
||||||
var headerColor = style.BackgroundHighlighted;
|
var headerColor = style.BackgroundHighlighted;
|
||||||
if (_headerRect.Contains(ref _mousePosition))
|
if (_headerRect.Contains(ref _mousePosition) && !Surface.IsConnecting && !Surface.IsBoxSelecting)
|
||||||
headerColor *= 1.07f;
|
headerColor *= 1.07f;
|
||||||
Render2D.FillRectangle(_headerRect, headerColor);
|
Render2D.FillRectangle(_headerRect, headerColor);
|
||||||
Render2D.DrawText(style.FontLarge, Title, _headerRect, style.Foreground, TextAlignment.Center, TextAlignment.Center);
|
Render2D.DrawText(style.FontLarge, Title, _headerRect, style.Foreground, TextAlignment.Center, TextAlignment.Center);
|
||||||
@@ -1078,7 +1078,8 @@ namespace FlaxEditor.Surface
|
|||||||
// Close button
|
// Close button
|
||||||
if ((Archetype.Flags & NodeFlags.NoCloseButton) == 0 && Surface.CanEdit)
|
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
|
// Footer
|
||||||
@@ -1123,8 +1124,9 @@ namespace FlaxEditor.Surface
|
|||||||
if (base.OnMouseUp(location, button))
|
if (base.OnMouseUp(location, button))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Close
|
// Close/ delete
|
||||||
if (button == MouseButton.Left && (Archetype.Flags & NodeFlags.NoCloseButton) == 0 && _closeButtonRect.Contains(ref location))
|
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);
|
Surface.Delete(this);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ namespace FlaxEditor.Surface
|
|||||||
|
|
||||||
_rootControl.DrawComments();
|
_rootControl.DrawComments();
|
||||||
|
|
||||||
if (IsSelecting)
|
if (IsBoxSelecting)
|
||||||
{
|
{
|
||||||
DrawSelection();
|
DrawSelection();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -590,6 +590,9 @@ namespace FlaxEditor.Surface
|
|||||||
// Cache flags and state
|
// Cache flags and state
|
||||||
if (_leftMouseDown && button == MouseButton.Left)
|
if (_leftMouseDown && button == MouseButton.Left)
|
||||||
{
|
{
|
||||||
|
WasBoxSelecting = IsBoxSelecting;
|
||||||
|
WasMovingSelection = _isMovingSelection;
|
||||||
|
|
||||||
_leftMouseDown = false;
|
_leftMouseDown = false;
|
||||||
EndMouseCapture();
|
EndMouseCapture();
|
||||||
Cursor = CursorType.Default;
|
Cursor = CursorType.Default;
|
||||||
|
|||||||
@@ -232,15 +232,25 @@ namespace FlaxEditor.Surface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether user is selecting nodes.
|
/// Gets a value indicating whether user is box selecting nodes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsSelecting => _leftMouseDown && !_isMovingSelection && _connectionInstigator == null;
|
public bool IsBoxSelecting => _leftMouseDown && !_isMovingSelection && _connectionInstigator == null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether user was previously box selecting nodes.
|
||||||
|
/// </summary>
|
||||||
|
public bool WasBoxSelecting { get; private set; }
|
||||||
|
|
||||||
/// <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 == null;
|
public bool IsMovingSelection => _leftMouseDown && _isMovingSelection && _connectionInstigator == null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether user was previously moving selected nodes.
|
||||||
|
/// </summary>
|
||||||
|
public bool WasMovingSelection { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether user is connecting nodes.
|
/// Gets a value indicating whether user is connecting nodes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user