Exemple #1
0
    public bool OnNodeSelected(Symbole symbole)
    {
        var e = Event.current;

        switch (e.type)
        {
        case EventType.MouseDown:
            if (e.button == 0)
            {
                if (symbole.NodeSize.Contains(few.InvGraphToScreenSpace(e.mousePosition)) && e.mousePosition.y > 18 && !symboleManager.selectedOutputPoint)
                {
                    isDragged   = true;
                    GUI.changed = true;
                }
                else
                {
                    symboleManager.selectedSymbole = null;
                    GUI.changed = true;
                    return(false);
                }
            }
            break;

        case EventType.MouseUp:
            isDragged = false;
            break;

        case EventType.MouseDrag:
            if (e.button == 0 && isDragged)
            {
                symbole.NodeSize = symboleManager.DragSymbole(symbole.NodeSize);
                e.Use();
            }
            break;
        }
        if (symbole.NodeSize.Contains(few.InvGraphToScreenSpace(e.mousePosition)) && e.mousePosition.y > 18 && !symboleManager.selectedOutputPoint)
        {
            return(true);
        }
        return(false);
    }
 public void Draw()
 {
     if (points != null)
     {
         foreach (var point in points)
         {
             if (point.connectionType == ConnectionType.Output)
             {
                 foreach (var input in point.Connections)
                 {
                     if (input.connectionType == ConnectionType.Input)
                     {
                         //var col = Color.Lerp(point.knobeColor, input.knobeColor, 0.5f);
                         DrawConnectionBezier(FlowchartEditorWindow.GraphToScreenSpace(point.PointPos.center), FlowchartEditorWindow.GraphToScreenSpace(input.PointPos.center), point.knobeColor, input.knobeColor);
                     }
                 }
             }
         }
     }
     if (callPoints != null)
     {
         foreach (var point in callPoints)
         {
             if (point.connectionType == ConnectionType.Call)
             {
                 foreach (var receive in point.connections)
                 {
                     if (receive.connectionType == ConnectionType.Receive)
                     {
                         //var col = Color.Lerp(point.knobeColor, input.knobeColor, 0.5f);
                         DrawBezier(point.Point.center, receive.Point.center, point.knobeColor);
                     }
                 }
             }
         }
     }
     if (symboles != null)
     {
         DrawSymboles();
         GUI.changed = true;
     }
     if (selectedOutputCallPoint)
     {
         DrawBezierPreview(few.InvGraphToScreenSpace(selectedOutputCallPoint.Point.center));
         GUI.changed = true;
     }
     if (selectedOutputPoint)
     {
         DrawBezierPreview(selectedOutputPoint.PointPos.center);
         GUI.changed = true;
     }
 }