Exemplo n.º 1
0
        void HandleMouseDown(MouseDownEvent mouseDownEvent)
        {
            // Get the docking settings for the window, as well as the
            // layout and mouse position when resize begins.
            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 = true;
            this.CaptureMouse();
            mouseDownEvent.StopPropagation();
        }
Exemplo n.º 2
0
        void OnMouseUp(MouseUpEvent evt)
        {
            bool emitDragFinishedEvent = m_Active;

            m_Active = false;

            if (m_Handle.HasMouseCapture())
            {
                m_Handle.ReleaseMouse();
            }

            evt.StopImmediatePropagation();

            // Recalculate which corner to dock to
            m_WindowDockingLayout.CalculateDockingCornerAndOffset(target.layout, target.parent.layout);
            m_WindowDockingLayout.ClampToParentWindow();

            // Use the docking results to figure which of left/right and top/bottom needs to be set.
            m_WindowDockingLayout.ApplyPosition(target);

            // Signal that the dragging has finished.
            if (emitDragFinishedEvent && OnDragFinished != null)
            {
                OnDragFinished();
            }
        }