Ejemplo n.º 1
0
        protected virtual void OnMouseDown(MouseDownEvent e)
        {
            if (m_Active)
            {
                e.StopImmediatePropagation();
                return;
            }

            if (!CanStartManipulation(e))
            {
                return;
            }

            var port = target.GetFirstAncestorOfType <Port>();

            if (port == null)
            {
                return;
            }

            m_MouseDownPosition = e.localMousePosition;

            m_EdgeDragHelper.CreateEdgeCandidate(port.PortModel.GraphModel);
            m_EdgeDragHelper.draggedPort = port.PortModel;

            if (m_EdgeDragHelper.HandleMouseDown(e))
            {
                m_Active = true;
                target.CaptureMouse();
                e.StopPropagation();
            }
            else
            {
                m_EdgeDragHelper.Reset();
            }
        }
Ejemplo n.º 2
0
 protected void OnKeyDown(KeyDownEvent evt)
 {
     if (m_Active)
     {
         if (evt.keyCode == KeyCode.Escape)
         {
             m_ConnectedEdgeDragHelper.Reset();
             if (m_AdditionalEdgeDragHelpers != null)
             {
                 foreach (var dragHelper in m_AdditionalEdgeDragHelpers)
                 {
                     dragHelper.Reset();
                 }
             }
             Reset();
             target.ReleaseMouse();
             evt.StopPropagation();
         }
     }
 }