Vector2 GetPosition(bool left)
 {
     if (visible)
     {
         var nodePosition = NodeView.GetWindowRect().position;
         var nodeSize     = NodeView.GetWindowRect().size;
         if (left)
         {
             return(nodePosition + new Vector2(-GetSize().x, height));
         }
         else
         {
             return(nodePosition + new Vector2(nodeSize.x, height));
         }
     }
     else
     {
         return(NodeView.GetWindowRect().center);
     }
 }
    public void Draw()
    {
        var  rect     = GetRect(left: false);
        var  guiStyle = RightGUIStyle;
        bool active   = false;

        var property = serializedObject.FindProperty(PropertyPath);

        if (property == null)
        {
            Dead = true;
            if (OnDeath != null)
            {
                OnDeath.Invoke();
            }

            return;
        }

        var currentTarget = property.objectReferenceValue;

        if (currentTarget != null)
        {
            var targetNodeView = NodeView.NodeEditor.GetNodeView(currentTarget);
            if (targetNodeView != null)
            {
                if (targetNodeView.GetWindowRect().position.x < NodeView.GetWindowRect().position.x)
                {
                    rect     = GetRect(left: true);
                    guiStyle = LeftGUIStyle;
                }

                if (!Connecting)
                {
                    Handles.DrawLine(rect.center, targetNodeView.GetWindowRect().center);
                }

                active = true;
            }
        }

        if (Connecting)
        {
            Handles.DrawLine(rect.center, Event.current.mousePosition);
            active = true;
        }

        if (active)
        {
            SwitchActiveState(guiStyle);
        }

        GUI.Box(rect, "", guiStyle);

        if (active)
        {
            SwitchActiveState(guiStyle);
        }

        HandleConnectorEvents(rect);
        ResetDrawProperties();
    }