public void OnEndDrag(PointerEventData eventData) { if (draggingLine == null) { return; } RRCSManager.Instance.selectionManager.SelectionEnabled = true; PortUi dstPort = null; foreach (GameObject go in eventData.hovered) { dstPort = go.GetComponent <PortUi>(); if (dstPort != null) { break; } } PortUi srcPort = draggingLine.sourcePortUi ?? this; draggingLine.Disconnect(); draggingLine = null; if (dstPort != null && (dstPort.nodeUi == null || !dstPort.nodeUi.IsSidebarNode)) { srcPort.port.Connect(dstPort.port); } }
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; }