Merge branch 'fix-view-band-sel' of https://github.com/Tryibion/FlaxEngine into Tryibion-fix-view-band-sel

This commit is contained in:
Wojtek Figat
2026-02-01 23:33:04 +01:00
2 changed files with 11 additions and 7 deletions

View File

@@ -36,11 +36,12 @@ public sealed class ViewportRubberBandSelector
/// Triggers the start of a rubber band selection.
/// </summary>
/// <returns>True if selection started, otherwise false.</returns>
public bool TryStartingRubberBandSelection()
public bool TryStartingRubberBandSelection(Float2 mousePosition)
{
if (!_isRubberBandSpanning && _owner.Gizmos.Active != null && !_owner.Gizmos.Active.IsControllingMouse && !_owner.IsRightMouseButtonDown)
{
_tryStartRubberBand = true;
_cachedStartingMousePosition = mousePosition;
return true;
}
return false;
@@ -82,12 +83,15 @@ public sealed class ViewportRubberBandSelector
return;
}
if (_tryStartRubberBand && (Mathf.Abs(_owner.MouseDelta.X) > 0.1f || Mathf.Abs(_owner.MouseDelta.Y) > 0.1f) && canStart)
if (_tryStartRubberBand && canStart)
{
_isRubberBandSpanning = true;
_cachedStartingMousePosition = mousePosition;
_rubberBandRect = new Rectangle(_cachedStartingMousePosition, Float2.Zero);
_tryStartRubberBand = false;
var delta = mousePosition - _cachedStartingMousePosition;
if (Mathf.Abs(delta.X) > 0.1f || Mathf.Abs(delta.Y) > 0.1f)
{
_isRubberBandSpanning = true;
_rubberBandRect = new Rectangle(_cachedStartingMousePosition, Float2.Zero);
_tryStartRubberBand = false;
}
}
else if (_isRubberBandSpanning && _owner.Gizmos.Active != null && !_owner.Gizmos.Active.IsControllingMouse && !_owner.IsRightMouseButtonDown)
{

View File

@@ -620,7 +620,7 @@ namespace FlaxEditor.Viewport
{
base.OnLeftMouseButtonDown();
_rubberBandSelector.TryStartingRubberBandSelection();
_rubberBandSelector.TryStartingRubberBandSelection(_viewMousePos);
}
/// <inheritdoc />