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

Method #arrangeWidgetInputSlots

src/LGraphNode.ts:3792–3813  ·  view source on GitHub ↗

* Arranges the layout of the node's widget input slots.

()

Source from the content-addressed store, hash-verified

3790 * Arranges the layout of the node's widget input slots.
3791 */
3792 #arrangeWidgetInputSlots(): void {
3793 if (!this.widgets) return
3794
3795 const slotByWidgetName = new Map<string, INodeInputSlot & { index: number }>()
3796
3797 for (const [i, slot] of this.inputs.entries()) {
3798 if (!isWidgetInputSlot(slot)) continue
3799
3800 slotByWidgetName.set(slot.widget.name, { ...slot, index: i })
3801 }
3802 if (!slotByWidgetName.size) return
3803
3804 for (const widget of this.widgets) {
3805 const slot = slotByWidgetName.get(widget.name)
3806 if (!slot) continue
3807
3808 const actualSlot = this.#concreteInputs[slot.index]
3809 const offset = LiteGraph.NODE_SLOT_HEIGHT * 0.5
3810 actualSlot.pos = [offset, widget.y + offset]
3811 this.#measureSlot(actualSlot, slot.index, true)
3812 }
3813 }
3814
3815 /**
3816 * @internal Sets the internal concrete slot arrays, ensuring they are instances of

Callers 1

arrangeMethod · 0.95

Calls 4

#measureSlotMethod · 0.95
isWidgetInputSlotFunction · 0.90
setMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected