void DrawConnections() { bool isMouseOverEdge = false; bool clickedOnEdge = false; for (int i = m_nodeViewList.length - 1; i >= 0; i--) { Node node = m_nodeViewList[i]; if (node.isHidden) { continue; } ConnectionPort[] fromPorts = node.outputs; for (int fromPortIndex = 0; fromPortIndex < fromPorts.Length; fromPortIndex++) { ConnectionPort fromPort = fromPorts[fromPortIndex]; if (fromPort.isHidden) { continue; } EdgePoint edgePoint1 = m_nodeViewList[node].GetEdgePointForPort(fromPort); ConnectionPort[] toPorts = fromPort.connectedPorts; for (int toPortIndex = 0; toPortIndex < toPorts.Length; toPortIndex++) { ConnectionPort toPort = toPorts[toPortIndex]; if (!m_nodeViewList.ContainsKey(toPort.node)) { continue; } if (toPort.isHidden) { continue; } if (toPort.node.isHidden) { continue; } EdgePoint edgePoint2 = m_nodeViewList[toPort.node].GetEdgePointForPort(toPort); if (IsRectInView(fromPort.rect) || IsRectInView(toPort.rect)) { bool mouseOverEdge = EditorGUI.DrawEdge(edgePoint1, edgePoint2, 3, () => { if (!clickedOnEdge) { clickedOnEdge = true; onEdgeClicked?.Invoke(fromPort, toPort); } }, !isMouseOverEdge, 15); if (mouseOverEdge) { isMouseOverEdge = true; } } } } } if (selectedPort) { EditorGUI.DrawEdgeToMouse(m_nodeViewList[selectedPort.node].GetEdgePointForPort(selectedPort), Color.white); } }