Exemplo n.º 1
0
        protected void OnMouseUp(MouseUpEvent e)
        {
            GraphElement ce = e.target as GraphElement;

            if (ce != null && !ce.IsMovable())
            {
                return;
            }

            if (m_Active)
            {
                if (CanStopManipulation(e))
                {
                    var graphElement = target as GraphElement;
                    if (graphElement != null)
                    {
                        graphElement.UpdatePresenterPosition();
                    }

                    m_Active = false;
                    target.ReleaseMouse();
                    e.StopPropagation();
                }
            }
        }
Exemplo n.º 2
0
        protected void OnMouseMove(MouseMoveEvent e)
        {
            GraphElement ce = e.target as GraphElement;

            if (ce != null && !ce.IsMovable())
            {
                return;
            }

            if (m_Active)
            {
                Vector2 diff = e.localMousePosition - m_Start;

                if (ce != null)
                {
                    var targetScale = ce.transform.scale;
                    diff.x *= targetScale.x;
                    diff.y *= targetScale.y;
                }

                Rect rect = CalculatePosition(target.layout.x + diff.x, target.layout.y + diff.y, target.layout.width, target.layout.height);

                if (target.IsLayoutManual())
                {
                    target.SetLayout(rect);
                }
                else if (target.resolvedStyle.position == Position.Absolute)
                {
                    target.style.left = rect.x;
                    target.style.top  = rect.y;
                }

                e.StopPropagation();
            }
        }
Exemplo n.º 3
0
        protected void OnMouseDown(MouseDownEvent e)
        {
            if (m_Active)
            {
                e.StopImmediatePropagation();
                return;
            }

            GraphElement ce = e.target as GraphElement;

            if (ce != null && !ce.IsMovable())
            {
                return;
            }

            if (CanStartManipulation(e))
            {
                m_Start = e.localMousePosition;

                m_Active = true;
                target.CaptureMouse();
                e.StopPropagation();
            }
        }