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

Method getOutputPos

src/LGraphNode.ts:3079–3099  ·  view source on GitHub ↗

* Gets the position of an output slot, in graph co-ordinates. * * This method is preferred over the legacy getConnectionPos method. * @param slot Output slot index * @returns Position of the output slot

(slot: number)

Source from the content-addressed store, hash-verified

3077 * @returns Position of the output slot
3078 */
3079 getOutputPos(slot: number): Point {
3080 const { pos: [nodeX, nodeY], outputs, size: [width] } = this
3081
3082 if (this.flags.collapsed) {
3083 const width = this._collapsed_width || LiteGraph.NODE_COLLAPSED_WIDTH
3084 const halfTitle = LiteGraph.NODE_TITLE_HEIGHT * 0.5
3085 return [nodeX + width, nodeY - halfTitle]
3086 }
3087
3088 const outputPos = outputs?.[slot]?.pos
3089 if (outputPos) return [nodeX + outputPos[0], nodeY + outputPos[1]]
3090
3091 // default vertical slots
3092 const offsetX = LiteGraph.NODE_SLOT_HEIGHT * 0.5
3093 const nodeOffsetY = this.constructor.slot_start_y || 0
3094 const slotIndex = this.#defaultVerticalOutputs.indexOf(this.outputs[slot])
3095 const slotY = (slotIndex + 0.7) * LiteGraph.NODE_SLOT_HEIGHT
3096
3097 // TODO: Why +1?
3098 return [nodeX + width + 1 - offsetX, nodeY + slotY + nodeOffsetY]
3099 }
3100
3101 /** @inheritdoc */
3102 snapToGrid(snapTo: number): boolean {

Callers 13

getSlotInPositionMethod · 0.95
#measureSlotMethod · 0.95
mockedOutputDropEventFunction · 0.80
LGraphNode.test.tsFile · 0.80
#processNodeClickMethod · 0.80
#processMiddleButtonMethod · 0.80
processMouseMoveMethod · 0.80
drawConnectionsMethod · 0.80
#renderFloatingLinksMethod · 0.80
constructorFunction · 0.80
getNodeOutputOnPosFunction · 0.80
constructorMethod · 0.80

Calls

no outgoing calls

Tested by 1

mockedOutputDropEventFunction · 0.64