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

Method getInputSlotPos

src/LGraphNode.ts:3052–3070  ·  view source on GitHub ↗

* Gets the position of an input slot, in graph co-ordinates. * @param input The actual node input object * @returns Position of the centre of the input slot in graph co-ordinates.

(input: INodeInputSlot)

Source from the content-addressed store, hash-verified

3050 * @returns Position of the centre of the input slot in graph co-ordinates.
3051 */
3052 getInputSlotPos(input: INodeInputSlot): Point {
3053 const { pos: [nodeX, nodeY] } = this
3054
3055 if (this.flags.collapsed) {
3056 const halfTitle = LiteGraph.NODE_TITLE_HEIGHT * 0.5
3057 return [nodeX, nodeY - halfTitle]
3058 }
3059
3060 const { pos } = input
3061 if (pos) return [nodeX + pos[0], nodeY + pos[1]]
3062
3063 // default vertical slots
3064 const offsetX = LiteGraph.NODE_SLOT_HEIGHT * 0.5
3065 const nodeOffsetY = this.constructor.slot_start_y || 0
3066 const slotIndex = this.#defaultVerticalInputs.indexOf(input)
3067 const slotY = (slotIndex + 0.7) * LiteGraph.NODE_SLOT_HEIGHT
3068
3069 return [nodeX + offsetX, nodeY + slotY + nodeOffsetY]
3070 }
3071
3072 /**
3073 * Gets the position of an output slot, in graph co-ordinates.

Callers 3

getInputPosMethod · 0.95
LGraphNode.test.tsFile · 0.80
processMouseMoveMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected