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