/// <summary> /// Returns the node at the specified canvas-space position in the specified editor and returns a possible focused knob aswell /// </summary> public static Node NodeAtPosition(NodeEditorState editorState, Vector2 canvasPos, out ConnectionKnob focusedKnob) { focusedKnob = null; if (editorState == null || NodeEditorInputSystem.shouldIgnoreInput(editorState)) { return(null); } NodeCanvas canvas = editorState.canvas; for (int nodeCnt = canvas.nodes.Count - 1; nodeCnt >= 0; nodeCnt--) { // Check from top to bottom because of the render order Node node = canvas.nodes [nodeCnt]; if (node.ClickTest(canvasPos, out focusedKnob)) { return(node); // Node is clicked on } } return(null); }