mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-27 10:14:06 +00:00
@@ -1472,7 +1472,7 @@ export class LGraphNode implements Positionable, IPinnable, IColorable {
|
||||
*/
|
||||
addInput(name: string, type: ISlotType, extra_info?: Partial<INodeInputSlot>): INodeInputSlot {
|
||||
type = type || 0
|
||||
const input: INodeInputSlot = new NodeInputSlot({ name: name, type: type, link: null })
|
||||
const input = new NodeInputSlot({ name: name, type: type, link: null })
|
||||
if (extra_info) Object.assign(input, extra_info)
|
||||
|
||||
this.inputs ||= []
|
||||
@@ -2878,10 +2878,9 @@ export class LGraphNode implements Positionable, IPinnable, IColorable {
|
||||
* @internal The inputs that are not positioned with absolute coordinates.
|
||||
*/
|
||||
get #defaultVerticalInputs() {
|
||||
return this.inputs.filter((slot: INodeInputSlot) => !(
|
||||
slot.pos ||
|
||||
(this.widgets?.length && isWidgetInputSlot(slot))
|
||||
))
|
||||
return this.inputs.filter(
|
||||
slot => !slot.pos && !(this.widgets?.length && isWidgetInputSlot(slot)),
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3489,7 +3488,7 @@ export class LGraphNode implements Positionable, IPinnable, IColorable {
|
||||
slots.push(layoutElement)
|
||||
}
|
||||
|
||||
return slots.length ? createBounds(slots, /** padding= */ 0) : null
|
||||
return slots.length ? createBounds(slots, 0) : null
|
||||
}
|
||||
|
||||
#getMouseOverSlot(slot: INodeSlot): INodeSlot | null {
|
||||
@@ -3658,7 +3657,7 @@ export class LGraphNode implements Positionable, IPinnable, IColorable {
|
||||
for (const [i, slot] of this.inputs.entries()) {
|
||||
if (!isWidgetInputSlot(slot)) continue
|
||||
|
||||
slotByWidgetName.set(slot.widget?.name, { ...slot, index: i })
|
||||
slotByWidgetName.set(slot.widget.name, { ...slot, index: i })
|
||||
}
|
||||
if (!slotByWidgetName.size) return
|
||||
|
||||
|
||||
@@ -364,20 +364,22 @@ export class LiteGraphGlobal {
|
||||
for (let slotType of allTypes) {
|
||||
if (slotType === "") slotType = "*"
|
||||
|
||||
const registerTo = out
|
||||
? "registered_slot_out_types"
|
||||
: "registered_slot_in_types"
|
||||
if (this[registerTo][slotType] === undefined)
|
||||
this[registerTo][slotType] = { nodes: [] }
|
||||
if (!this[registerTo][slotType].nodes.includes(class_type))
|
||||
this[registerTo][slotType].nodes.push(class_type)
|
||||
const register = out
|
||||
? this.registered_slot_out_types
|
||||
: this.registered_slot_in_types
|
||||
register[slotType] ??= { nodes: [] }
|
||||
|
||||
const { nodes } = register[slotType]
|
||||
if (!nodes.includes(class_type)) nodes.push(class_type)
|
||||
|
||||
// check if is a new type
|
||||
const types = out
|
||||
? this.slot_types_out
|
||||
: this.slot_types_in
|
||||
if (!types.includes(slotType.toLowerCase())) {
|
||||
types.push(slotType.toLowerCase())
|
||||
const type = slotType.toLowerCase()
|
||||
|
||||
if (!types.includes(type)) {
|
||||
types.push(type)
|
||||
types.sort()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,18 +139,16 @@ export abstract class NodeSlot implements INodeSlot {
|
||||
|
||||
draw(
|
||||
ctx: CanvasRenderingContext2D,
|
||||
options: IDrawOptions,
|
||||
) {
|
||||
const {
|
||||
{
|
||||
pos,
|
||||
colorContext,
|
||||
labelColor = "#AAA",
|
||||
labelPosition = LabelPosition.Right,
|
||||
lowQuality = false,
|
||||
highlight = false,
|
||||
} = options
|
||||
let { doStroke = false } = options
|
||||
|
||||
doStroke = false,
|
||||
}: IDrawOptions,
|
||||
) {
|
||||
// Save the current fillStyle and strokeStyle
|
||||
const originalFillStyle = ctx.fillStyle
|
||||
const originalStrokeStyle = ctx.strokeStyle
|
||||
|
||||
@@ -69,7 +69,11 @@ export interface Positionable extends Parent<Positionable> {
|
||||
snapToGrid(snapTo: number): boolean
|
||||
|
||||
/**
|
||||
* Cached position & size as `x, y, width, height`.
|
||||
* A rectangle that represents the outer edges of the item.
|
||||
*
|
||||
* Used for various calculations, such as overlap, selective rendering, and click checks.
|
||||
* For most items, this is cached position & size as `x, y, width, height`.
|
||||
* Some items (such as nodes) may extend above and/or to the left of their {@link pos}.
|
||||
* @readonly
|
||||
* @see {@link move}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user