Fix rubber band selector activating outside of the viewport

This usually happens while trying to drag the window from window handle
This commit is contained in:
2025-04-16 20:57:12 +03:00
parent a1ccbbb5b9
commit ebf3999cfe

View File

@@ -1570,13 +1570,10 @@ namespace FlaxEditor.Viewport
// Get parent window // Get parent window
var win = (WindowRootControl)Root; var win = (WindowRootControl)Root;
if (win.IsFocused)
// Get current mouse position in the view
{ {
// When the window is not focused, the position in window does not return sane values // Get current mouse position in the view
Float2 pos = PointFromWindow(win.MousePosition); _viewMousePos = PointFromWindow(win.MousePosition);
if (!float.IsInfinity(pos.LengthSquared))
_viewMousePos = pos;
} }
// Update input // Update input
@@ -1594,8 +1591,8 @@ namespace FlaxEditor.Viewport
EndMouseCapture(); EndMouseCapture();
} }
#if PLATFORM_SDL #if PLATFORM_SDL
bool useMouse = IsControllingMouse || true;
_prevInput = _input; _prevInput = _input;
bool useMouse = IsControllingMouse || ContainsPoint(ref _viewMousePos) || _prevInput.IsControllingMouse;
if (canUseInput && ContainsFocus) if (canUseInput && ContainsFocus)
_input.Gather(win.Window, useMouse, ref _prevInput); _input.Gather(win.Window, useMouse, ref _prevInput);
else else