|
|
|
|
|
|
|
|
|
|
bool m_Dragging; |
|
|
|
|
|
|
|
float m_InitialAspectRatio; |
|
|
|
|
|
|
|
Rect m_ResizeBeginLayout; |
|
|
|
Vector2 m_ResizeBeginMousePosition; |
|
|
|
|
|
|
|
|
|
|
void InitialLayoutSetup(GeometryChangedEvent evt) |
|
|
|
{ |
|
|
|
m_ResizeTarget.UnregisterCallback<GeometryChangedEvent>(InitialLayoutSetup); |
|
|
|
m_InitialAspectRatio = m_ResizeTarget.layout.width / m_ResizeTarget.layout.height; |
|
|
|
m_InitialAspectRatio = 1f; |
|
|
|
} |
|
|
|
|
|
|
|
Vector2 BoundedMousePosition(Vector2 mousePosition) |
|
|
|
{ |
|
|
|
mousePosition = m_Container.parent.WorldToLocal(mousePosition); |
|
|
|
|
|
|
|
if (!stayWithinParentBounds) |
|
|
|
return mousePosition; |
|
|
|
|
|
|
|
mousePosition.x = Mathf.Clamp(mousePosition.x, 5f, m_Container.parent.layout.width); |
|
|
|
mousePosition.y = Mathf.Clamp(mousePosition.y, 5f, m_Container.parent.layout.height); |
|
|
|
|
|
|
|
return mousePosition; |
|
|
|
} |
|
|
|
|
|
|
|
void HandleResizeFromTop(MouseMoveEvent mouseMoveEvent) |
|
|
|
|
|
|
mouseMoveEvent.StopPropagation(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Applydocking() |
|
|
|
{ |
|
|
|
m_WindowDockingLayout.CalculateDockingCornerAndOffset(m_Container.layout, m_Container.parent.layout); |
|
|
|
|
|
|
|
if (m_WindowDockingLayout.dockingLeft) |
|
|
|
{ |
|
|
|
m_Container.style.positionLeft = StyleValue<float>.Create(m_WindowDockingLayout.horizontalOffset); |
|
|
|
m_Container.style.positionRight = StyleValue<float>.Create(float.NaN); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
m_Container.style.positionLeft = StyleValue<float>.Create(float.NaN); |
|
|
|
m_Container.style.positionRight = StyleValue<float>.Create(m_WindowDockingLayout.horizontalOffset); |
|
|
|
} |
|
|
|
|
|
|
|
if (m_WindowDockingLayout.dockingTop) |
|
|
|
{ |
|
|
|
m_Container.style.positionTop = StyleValue<float>.Create(m_WindowDockingLayout.verticalOffset); |
|
|
|
m_Container.style.positionBottom = StyleValue<float>.Create(float.NaN); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
m_Container.style.positionTop = StyleValue<float>.Create(float.NaN); |
|
|
|
m_Container.style.positionBottom = StyleValue<float>.Create(m_WindowDockingLayout.verticalOffset); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Applydocking(); |
|
|
|
m_WindowDockingLayout.CalculateDockingCornerAndOffset(m_Container.layout, m_Container.parent.layout); |
|
|
|
m_WindowDockingLayout.ApplyPosition(m_Container); |
|
|
|
|
|
|
|
m_ResizeBeginLayout = m_ResizeTarget.layout; |
|
|
|
m_ResizeBeginMousePosition = mouseDownEvent.mousePosition; |
|
|
|
|
|
|
|
|
|
|
m_Dragging = false; |
|
|
|
|
|
|
|
if (this.HasMouseCapture()) |
|
|
|
{ |
|
|
|
} |
|
|
|
{ |
|
|
|
} |
|
|
|
Applydocking(); |
|
|
|
m_WindowDockingLayout.CalculateDockingCornerAndOffset(m_Container.layout, m_Container.parent.layout); |
|
|
|
m_WindowDockingLayout.ApplyPosition(m_Container); |
|
|
|
} |
|
|
|
} |
|
|
|
} |