Ejemplo n.º 1
0
 void CheckMouseEvent(Event e)
 {
     //start a connection action
     if (e.button == 0 && e.type == EventType.MouseDown)
     {
         //add connection
         if (e.shift)
         {
             action        = ConnectionAction.Add;
             currentSearch = SearchReason.Start;
             e.Use();
         }
         //remove connection
         else if (e.control)
         {
             action        = ConnectionAction.Delete;
             currentSearch = SearchReason.Start;
             e.Use();
         }
     }
     else if (e.button == 0 && e.type == EventType.MouseDrag)
     {
         currentSearch = SearchReason.End;
         e.Use();
     }
 }
Ejemplo n.º 2
0
    void OnEnable()
    {
        set      = (PTPSet)target;
        LastTool = Tools.current;

        currentSearch = SearchReason.None;

        start = null;
        end   = null;
    }
Ejemplo n.º 3
0
    void CheckEndOfDrag(Event e)
    {
        //Check the event type and make sure it's left click.
        if (e.type == EventType.mouseUp && e.button == 0)
        {
            if (start != null && end != null)
            {
                if (action == ConnectionAction.Add)
                {
                    start.AddConnection(end, 1);
                }
                else
                {
                    start.RemoveConnection(end);
                }
            }

            currentSearch = SearchReason.None;

            start = null;
            end   = null;
            e.Use();
        }
    }