Exemple #1
0
        private void OnMouseMove(MouseMoveEvent e)
        {
            GraphElement graphElement = base.parent as GraphElement;

            if (graphElement != null)
            {
                if (graphElement.IsResizable())
                {
                    if (this.m_Active && base.parent.style.positionType == PositionType.Manual)
                    {
                        Vector2 vector  = this.ChangeCoordinatesTo(base.parent, e.localMousePosition) - this.m_Start;
                        Vector2 vector2 = new Vector2(this.m_StartPos.width + vector.x, this.m_StartPos.height + vector.y);
                        if (vector2.x < this.m_MinimumSize.x)
                        {
                            vector2.x = this.m_MinimumSize.x;
                        }
                        if (vector2.y < this.m_MinimumSize.y)
                        {
                            vector2.y = this.m_MinimumSize.y;
                        }
                        graphElement.SetPosition(new Rect(graphElement.layout.x, graphElement.layout.y, vector2.x, vector2.y));
                        graphElement.UpdatePresenterPosition();
                        GraphView firstAncestorOfType = graphElement.GetFirstAncestorOfType <GraphView>();
                        if (firstAncestorOfType != null && firstAncestorOfType.elementResized != null)
                        {
                            firstAncestorOfType.elementResized(graphElement);
                        }
                        this.m_LabelText.text = string.Format("{0:0}", base.parent.layout.width) + "x" + string.Format("{0:0}", base.parent.layout.height);
                        e.StopPropagation();
                    }
                }
            }
        }
Exemple #2
0
        protected void OnMouseUp(MouseUpEvent e)
        {
            GraphElement graphElement = e.target as GraphElement;

            if (graphElement == null || graphElement.IsMovable())
            {
                if (this.m_Active)
                {
                    if (base.CanStopManipulation(e))
                    {
                        GraphElement graphElement2 = base.target as GraphElement;
                        if (graphElement2 != null)
                        {
                            graphElement2.UpdatePresenterPosition();
                        }
                        this.m_Active = false;
                        base.target.ReleaseMouseCapture();
                        e.StopPropagation();
                    }
                }
            }
        }