diff --git a/Source/Editor/Viewport/EditorViewport.cs b/Source/Editor/Viewport/EditorViewport.cs
index 4981b78e9..1e24560d8 100644
--- a/Source/Editor/Viewport/EditorViewport.cs
+++ b/Source/Editor/Viewport/EditorViewport.cs
@@ -65,6 +65,11 @@ namespace FlaxEditor.Viewport
///
public bool IsAltDown;
+ ///
+ /// The is alt down flag cached from the previous input. Used to make consistent when user releases Alt while orbiting with Alt+LMB.
+ ///
+ public bool WasAltDownBefore;
+
///
/// The is mouse right down flag.
///
@@ -88,18 +93,20 @@ namespace FlaxEditor.Viewport
///
/// Gets a value indicating whether use is controlling mouse.
///
- public bool IsControllingMouse => IsMouseMiddleDown || IsMouseRightDown || (IsAltDown && IsMouseLeftDown) || Mathf.Abs(MouseWheelDelta) > 0.1f;
+ public bool IsControllingMouse => IsMouseMiddleDown || IsMouseRightDown || ((IsAltDown || WasAltDownBefore) && IsMouseLeftDown) || Mathf.Abs(MouseWheelDelta) > 0.1f;
///
/// Gathers input from the specified window.
///
/// The window.
/// True if use mouse input, otherwise will skip mouse.
- public void Gather(Window window, bool useMouse)
+ /// Previous input state.
+ public void Gather(Window window, bool useMouse, ref Input prevInput)
{
IsControlDown = window.GetKey(KeyboardKeys.Control);
IsShiftDown = window.GetKey(KeyboardKeys.Shift);
IsAltDown = window.GetKey(KeyboardKeys.Alt);
+ WasAltDownBefore = prevInput.WasAltDownBefore || prevInput.IsAltDown;
IsMouseRightDown = useMouse && window.GetMouseButton(MouseButton.Right);
IsMouseMiddleDown = useMouse && window.GetMouseButton(MouseButton.Middle);
@@ -114,6 +121,7 @@ namespace FlaxEditor.Viewport
IsControlDown = false;
IsShiftDown = false;
IsAltDown = false;
+ WasAltDownBefore = false;
IsMouseRightDown = false;
IsMouseMiddleDown = false;
@@ -1540,7 +1548,7 @@ namespace FlaxEditor.Viewport
_prevInput = _input;
var hit = GetChildAt(_viewMousePos, c => c.Visible && !(c is CanvasRootControl) && !(c is UIEditorRoot));
if (canUseInput && ContainsFocus && hit == null)
- _input.Gather(win.Window, useMouse);
+ _input.Gather(win.Window, useMouse, ref _prevInput);
else
_input.Clear();