@@ -34,12 +34,15 @@ public class ViewportRubberBandSelector
|
||||
/// <summary>
|
||||
/// Triggers the start of a rubber band selection.
|
||||
/// </summary>
|
||||
public void TryStartingRubberBandSelection()
|
||||
/// <returns>True if selection started, otherwise false.</returns>
|
||||
public bool TryStartingRubberBandSelection()
|
||||
{
|
||||
if (!_isRubberBandSpanning && !_owner.Gizmos.Active.IsControllingMouse && !_owner.IsRightMouseButtonDown)
|
||||
{
|
||||
_tryStartRubberBand = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -248,9 +251,12 @@ public class ViewportRubberBandSelector
|
||||
/// <summary>
|
||||
/// Immediately stops the rubber band.
|
||||
/// </summary>
|
||||
public void StopRubberBand()
|
||||
/// <returns>True if rubber band was active before stopping.</returns>
|
||||
public bool StopRubberBand()
|
||||
{
|
||||
var result = _tryStartRubberBand;
|
||||
_isRubberBandSpanning = false;
|
||||
_tryStartRubberBand = false;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,14 +493,18 @@ namespace FlaxEditor.Viewport
|
||||
public override void OnLostFocus()
|
||||
{
|
||||
base.OnLostFocus();
|
||||
_rubberBandSelector.StopRubberBand();
|
||||
|
||||
if (_rubberBandSelector.StopRubberBand())
|
||||
EndMouseCapture();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnMouseLeave()
|
||||
{
|
||||
base.OnMouseLeave();
|
||||
_rubberBandSelector.StopRubberBand();
|
||||
|
||||
if (_rubberBandSelector.StopRubberBand())
|
||||
EndMouseCapture();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -615,8 +619,11 @@ namespace FlaxEditor.Viewport
|
||||
protected override void OnLeftMouseButtonDown()
|
||||
{
|
||||
base.OnLeftMouseButtonDown();
|
||||
|
||||
_rubberBandSelector.TryStartingRubberBandSelection();
|
||||
|
||||
if (_rubberBandSelector.TryStartingRubberBandSelection())
|
||||
{
|
||||
StartMouseCapture();
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -629,6 +636,8 @@ namespace FlaxEditor.Viewport
|
||||
// Select rubberbanded rect actor nodes or pick with gizmo
|
||||
if (!_rubberBandSelector.ReleaseRubberBandSelection())
|
||||
{
|
||||
EndMouseCapture();
|
||||
|
||||
// Try to pick something with the current gizmo
|
||||
Gizmos.Active?.Pick();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user