Moved check and ops to also fix issue #683

This commit is contained in:
Chandler Cox
2022-11-27 14:23:01 -06:00
parent 8707d658f1
commit 4a9a01a89e
2 changed files with 10 additions and 10 deletions

View File

@@ -37,6 +37,16 @@ namespace FlaxEditor.GUI.Docking
// Focus window
window.Focus();
// Check if window is maximized and restore window.
if (window.IsMaximized)
{
// Restore window and set position to mouse.
var mousePos = window.MousePosition;
var previousSize = window.Size;
window.Restore();
window.Position = FlaxEngine.Input.MouseScreenPosition - mousePos * window.Size / previousSize;
}
// Calculate dragging offset and move window to the destination position
var mouseScreenPosition = FlaxEngine.Input.MouseScreenPosition;

View File

@@ -51,16 +51,6 @@ namespace FlaxEditor.GUI.Docking
if (_window == null)
return;
// Check if window is maximized
if (_window.IsMaximized)
{
// Restore window and set position to mouse.
var mousePos = _window.MousePosition;
var previousSize = _window.Size;
_window.Restore();
_window.Window.Position = FlaxEngine.Input.MouseScreenPosition - mousePos * _window.Size / previousSize;
}
// Create docking hint window
DockHintWindow.Create(this);
}