Beispiel #1
0
        public void OnBeginDrag(PointerEventData eventData)
        {
            if (eventData.button != 0)
            {
                return;
            }
            if (draggingLine != null)
            {
                return;
            }
            if (nodeUi && nodeUi.IsSidebarNode)
            {
                return;
            }

            PortUi srcPort = this;

            if (isInput && HasLines)
            {
                //connectedLines should contain exactly 1 entry.
                ConnectionUi entry = connectedLines[0];
                entry.Disconnect();
                srcPort = entry.sourcePortUi;
            }

            draggingLine = Instantiate(connectionPrefab, linesContainer).GetComponent <ConnectionUi>();
            DebugUtils.Assert(draggingLine != null);

            draggingLine.sourcePortUi = srcPort;

            draggingLine.SetVirtualTargetPosition(Center);
            draggingLine.UpdateColors();

            RRCSManager.Instance.selectionManager.SelectionEnabled = false;
        }
Beispiel #2
0
        public void OnDrag(PointerEventData eventData)
        {
            if (draggingLine == null)
            {
                return;
            }
            Vector2 pos =
                eventData.pressEventCamera
                .ScreenToWorldPoint(eventData.position);                         //Cast Vector3 to Vector2 to discard the z coordinate

            draggingLine.SetVirtualTargetPosition(pos);
        }