Beispiel #1
0
 private void DiscardCandidatePort(MouseLeaveEvent evt)
 {
     if (candidatePort == evt.target)
     {
         candidatePort = null;
     }
 }
Beispiel #2
0
 private void UnregisterPortEvents(LokiPort port)
 {
     if (port == null)
     {
         return;
     }
     port.GetFirstAncestorOfType <LokiNodeView>().UnregisterCallback <GeometryChangedEvent>(OnPortGeometryChanged);
 }
Beispiel #3
0
        public void Connect(LokiPort fromPort, LokiPort toPort)
        {
            if (fromPort == null)
            {
                DestroySelf();
                return;
            }

            if (fromPort == toPort)
            {
                DestroySelf();
                return;
            }

            UnregisterPortEvents(this.fromPort);
            UnregisterPortEvents(this.toPort);


            this.fromPort = fromPort;
            this.toPort   = toPort;

            RegisterPortEvents(fromPort);
            RegisterPortEvents(toPort);

            switch (state)             // Check if edge is closed after this Connect call, or it's still open
            {
            case State.Open:
                this.CaptureMouse();
                CollectEligiblePorts();
                break;

            case State.Closed:
                fromPort.ConnectEdge(this);
                toPort.ConnectEdge(this);
                this.ReleaseMouse();
                ReleaseEligiblePorts();
                break;
            }

            mouseWorldPosition = this.fromPort.connectionWorldPos;
            TriggerRepaint();
        }
Beispiel #4
0
 private void ReadPort(LokiPort port, out Vector3 point, out Vector3 dir, out Color color)
 {
     point = this.WorldToLocal(port.connectionWorldPos);
     dir   = port.directionVec;
     color = port.color.value;
 }
Beispiel #5
0
 private void SetCandidatePort(MouseEnterEvent evt)
 {
     candidatePort = evt.target as LokiPort;
 }