Fix editor viewport activating while dragging a window
This commit is contained in:
@@ -32,9 +32,15 @@ namespace FlaxEditor.GUI.Docking
|
|||||||
/// The opacity of the dragged window when hint controls are shown.
|
/// The opacity of the dragged window when hint controls are shown.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const float DragWindowOpacity = 0.4f;
|
public const float DragWindowOpacity = 0.4f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if any windows are being dragged.
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsDragActive { get; private set; }
|
||||||
|
|
||||||
private WindowDragHelper(FloatWindowDockPanel toMove, Window dragSourceWindow)
|
private WindowDragHelper(FloatWindowDockPanel toMove, Window dragSourceWindow)
|
||||||
{
|
{
|
||||||
|
IsDragActive = true;
|
||||||
_toMove = toMove;
|
_toMove = toMove;
|
||||||
_toSet = DockState.Float;
|
_toSet = DockState.Float;
|
||||||
var window = toMove.Window.Window;
|
var window = toMove.Window.Window;
|
||||||
@@ -72,6 +78,7 @@ namespace FlaxEditor.GUI.Docking
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
IsDragActive = false;
|
||||||
var window = _toMove?.Window?.Window;
|
var window = _toMove?.Window?.Window;
|
||||||
|
|
||||||
// Unbind events
|
// Unbind events
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FlaxEditor.Content.Settings;
|
using FlaxEditor.Content.Settings;
|
||||||
using FlaxEditor.GUI.ContextMenu;
|
using FlaxEditor.GUI.ContextMenu;
|
||||||
|
using FlaxEditor.GUI.Docking;
|
||||||
using FlaxEditor.GUI.Input;
|
using FlaxEditor.GUI.Input;
|
||||||
using FlaxEditor.Options;
|
using FlaxEditor.Options;
|
||||||
using FlaxEditor.Viewport.Cameras;
|
using FlaxEditor.Viewport.Cameras;
|
||||||
@@ -1578,7 +1579,7 @@ namespace FlaxEditor.Viewport
|
|||||||
|
|
||||||
// Update input
|
// Update input
|
||||||
var window = win.Window;
|
var window = win.Window;
|
||||||
var canUseInput = window != null && window.IsFocused && window.IsForegroundWindow;
|
var canUseInput = window != null && window.IsFocused && window.IsForegroundWindow && !WindowDragHelper.IsDragActive;
|
||||||
{
|
{
|
||||||
// Get input buttons and keys (skip if viewport has no focus or mouse is over a child control)
|
// Get input buttons and keys (skip if viewport has no focus or mouse is over a child control)
|
||||||
var isViewportControllingMouse = canUseInput && IsControllingMouse;
|
var isViewportControllingMouse = canUseInput && IsControllingMouse;
|
||||||
|
|||||||
Reference in New Issue
Block a user