Allow window with single tab to be dragged from tab area
This commit is contained in:
@@ -50,6 +50,11 @@ namespace FlaxEditor.GUI.Docking
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Float2 MousePosition = Float2.Minimum;
|
public Float2 MousePosition = Float2.Minimum;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The mouse position.
|
||||||
|
/// </summary>
|
||||||
|
public Float2 MouseStartPosition = Float2.Minimum;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The start drag asynchronous window.
|
/// The start drag asynchronous window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -355,6 +360,7 @@ namespace FlaxEditor.GUI.Docking
|
|||||||
if (IsSingleFloatingWindow)
|
if (IsSingleFloatingWindow)
|
||||||
return base.OnMouseDown(location, button);
|
return base.OnMouseDown(location, button);
|
||||||
MouseDownWindow = GetTabAtPos(location, out IsMouseDownOverCross);
|
MouseDownWindow = GetTabAtPos(location, out IsMouseDownOverCross);
|
||||||
|
MouseStartPosition = location;
|
||||||
|
|
||||||
// Check buttons
|
// Check buttons
|
||||||
if (button == MouseButton.Left)
|
if (button == MouseButton.Left)
|
||||||
@@ -441,6 +447,20 @@ namespace FlaxEditor.GUI.Docking
|
|||||||
StartDrag(MouseDownWindow);
|
StartDrag(MouseDownWindow);
|
||||||
MouseDownWindow = null;
|
MouseDownWindow = null;
|
||||||
}
|
}
|
||||||
|
// Check if single tab is tried to be moved
|
||||||
|
else if (MouseDownWindow != null && _panel.TabsCount <= 1)
|
||||||
|
{
|
||||||
|
if ((MousePosition - MouseStartPosition).Length > 3)
|
||||||
|
{
|
||||||
|
// Clear flag
|
||||||
|
IsMouseLeftButtonDown = false;
|
||||||
|
|
||||||
|
// Check tab under the mouse
|
||||||
|
if (!IsMouseDownOverCross && MouseDownWindow != null)
|
||||||
|
StartDrag(MouseDownWindow);
|
||||||
|
MouseDownWindow = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Check if has more than one tab to change order
|
// Check if has more than one tab to change order
|
||||||
else if (MouseDownWindow != null && _panel.TabsCount > 1)
|
else if (MouseDownWindow != null && _panel.TabsCount > 1)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user