Esempio n. 1
0
        void OnPointerMove(PointerMoveEvent e)
        {
            GraphView graphView    = null;
            Vector2   pointerDelta = Vector2.zero;

            if (m_DraggingControlPoint || m_DraggingTightness)
            {
                graphView = GetFirstAncestorOfType <GraphView>();
                var pointerPosition = this.ChangeCoordinatesTo(parent, e.localPosition);
                pointerDelta = new Vector2(pointerPosition.x, pointerPosition.y) - m_OriginalPointerPosition;
            }

            if (graphView == null)
            {
                return;
            }

            if (m_DraggingControlPoint)
            {
                var newPosition = m_OriginalElementPosition + pointerDelta;
                graphView.Store.Dispatch(new MoveEdgeControlPointAction(m_EdgeModel, m_ControlPointIndex, newPosition, m_OriginalTightness));
                m_EdgeControl.MarkDirtyRepaint();
                e.StopPropagation();
            }
            else if (m_DraggingTightness)
            {
                var tightnessDelta = pointerDelta.x - pointerDelta.y;
                var newTightness   = m_OriginalTightness + tightnessDelta;
                graphView.Store.Dispatch(new MoveEdgeControlPointAction(m_EdgeModel, m_ControlPointIndex, m_OriginalElementPosition, newTightness));
                e.StopPropagation();
                m_EdgeControl.MarkDirtyRepaint();
            }
        }
Esempio n. 2
0
 public virtual bool UpdateEdgeControl()
 {
     EdgeControl.UpdateLayout();
     EnableInClassList(k_EditModeClassName, EdgeModel.EditMode);
     UpdateEdgeControlColorsAndWidth();
     EdgeControl.MarkDirtyRepaint();
     return(true);
 }