MCPcopy Create free account
hub / github.com/Comfy-Org/litegraph.js / getNodeOnPos

Method getNodeOnPos

src/LGraph.ts:1036–1048  ·  view source on GitHub ↗

* Returns the top-most node in this position of the canvas * @param x the x coordinate in canvas space * @param y the y coordinate in canvas space * @param nodeList a list with all the nodes to search from, by default is all the nodes in the graph * @returns the node at this position or

(
    x: number,
    y: number,
    nodeList?: LGraphNode[],
  )

Source from the content-addressed store, hash-verified

1034 * @returns the node at this position or null
1035 */
1036 getNodeOnPos(
1037 x: number,
1038 y: number,
1039 nodeList?: LGraphNode[],
1040 ): LGraphNode | null {
1041 const nodes = nodeList || this._nodes
1042 let i = nodes.length
1043 while (--i >= 0) {
1044 const node = nodes[i]
1045 if (node.isPointInside(x, y)) return node
1046 }
1047 return null
1048 }
1049
1050 /**
1051 * Returns the top-most group in that position

Callers

nothing calls this directly

Calls 1

isPointInsideMethod · 0.45

Tested by

no test coverage detected