mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 18:52:19 +00:00
build
This commit is contained in:
@@ -3711,99 +3711,94 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var changed = false;
|
var changed = false;
|
||||||
|
|
||||||
//if there is something already plugged there, disconnect
|
|
||||||
if (target_node.inputs[target_slot].link != null) {
|
|
||||||
this.graph.beforeChange();
|
|
||||||
target_node.disconnectInput(target_slot);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//why here??
|
|
||||||
//this.setDirtyCanvas(false,true);
|
|
||||||
//this.graph.connectionChange( this );
|
|
||||||
|
|
||||||
var output = this.outputs[slot];
|
|
||||||
|
|
||||||
//allows nodes to block connection
|
|
||||||
if (target_node.onConnectInput) {
|
|
||||||
if ( target_node.onConnectInput(target_slot, output.type, output, this, slot) === false ) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var input = target_node.inputs[target_slot];
|
var input = target_node.inputs[target_slot];
|
||||||
|
var output = this.outputs[slot];
|
||||||
var link_info = null;
|
var link_info = null;
|
||||||
|
|
||||||
//this slots cannot be connected (different types)
|
if (LiteGraph.isValidConnection(output.type, input.type)) {
|
||||||
if (!LiteGraph.isValidConnection(output.type, input.type))
|
if (target_node.onBeforeConnectInput) {
|
||||||
{
|
// This way node can choose another slot (if selected is occupied)
|
||||||
this.setDirtyCanvas(false, true);
|
target_slot = target_node.onBeforeConnectInput(target_slot);
|
||||||
if(changed)
|
}
|
||||||
this.graph.connectionChange(this, link_info);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!changed)
|
//if there is something already plugged there, disconnect
|
||||||
this.graph.beforeChange();
|
if (target_node.inputs[target_slot].link != null) {
|
||||||
|
target_node.disconnectInput(target_slot);
|
||||||
|
}
|
||||||
|
|
||||||
//create link class
|
//why here??
|
||||||
link_info = new LLink(
|
//this.setDirtyCanvas(false,true);
|
||||||
++this.graph.last_link_id,
|
//this.graph.connectionChange( this );
|
||||||
input.type,
|
|
||||||
this.id,
|
|
||||||
slot,
|
|
||||||
target_node.id,
|
|
||||||
target_slot
|
|
||||||
);
|
|
||||||
|
|
||||||
//add to graph links list
|
//allows nodes to block connection
|
||||||
this.graph.links[link_info.id] = link_info;
|
if (target_node.onConnectInput) {
|
||||||
|
if ( target_node.onConnectInput(target_slot, output.type, output, this, slot) === false ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.onConnectOutput) {
|
||||||
|
if ( this.onConnectOutput(slot, input.type, input, target_node, target_slot) === false ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//connect in output
|
link_info = new LLink(
|
||||||
if (output.links == null) {
|
++this.graph.last_link_id,
|
||||||
output.links = [];
|
input.type,
|
||||||
}
|
this.id,
|
||||||
output.links.push(link_info.id);
|
slot,
|
||||||
//connect in input
|
target_node.id,
|
||||||
target_node.inputs[target_slot].link = link_info.id;
|
target_slot
|
||||||
if (this.graph) {
|
);
|
||||||
this.graph._version++;
|
|
||||||
}
|
//add to graph links list
|
||||||
if (this.onConnectionsChange) {
|
this.graph.links[link_info.id] = link_info;
|
||||||
this.onConnectionsChange(
|
|
||||||
LiteGraph.OUTPUT,
|
//connect in output
|
||||||
slot,
|
if (output.links == null) {
|
||||||
true,
|
output.links = [];
|
||||||
link_info,
|
}
|
||||||
output
|
output.links.push(link_info.id);
|
||||||
);
|
//connect in input
|
||||||
} //link_info has been created now, so its updated
|
target_node.inputs[target_slot].link = link_info.id;
|
||||||
if (target_node.onConnectionsChange) {
|
if (this.graph) {
|
||||||
target_node.onConnectionsChange(
|
this.graph._version++;
|
||||||
LiteGraph.INPUT,
|
}
|
||||||
target_slot,
|
if (this.onConnectionsChange) {
|
||||||
true,
|
this.onConnectionsChange(
|
||||||
link_info,
|
LiteGraph.OUTPUT,
|
||||||
input
|
slot,
|
||||||
);
|
true,
|
||||||
}
|
link_info,
|
||||||
if (this.graph && this.graph.onNodeConnectionChange) {
|
output
|
||||||
this.graph.onNodeConnectionChange(
|
);
|
||||||
LiteGraph.INPUT,
|
} //link_info has been created now, so its updated
|
||||||
target_node,
|
if (target_node.onConnectionsChange) {
|
||||||
target_slot,
|
target_node.onConnectionsChange(
|
||||||
this,
|
LiteGraph.INPUT,
|
||||||
slot
|
target_slot,
|
||||||
);
|
true,
|
||||||
this.graph.onNodeConnectionChange(
|
link_info,
|
||||||
LiteGraph.OUTPUT,
|
input
|
||||||
this,
|
);
|
||||||
slot,
|
}
|
||||||
target_node,
|
if (this.graph && this.graph.onNodeConnectionChange) {
|
||||||
target_slot
|
this.graph.onNodeConnectionChange(
|
||||||
);
|
LiteGraph.INPUT,
|
||||||
}
|
target_node,
|
||||||
|
target_slot,
|
||||||
|
this,
|
||||||
|
slot
|
||||||
|
);
|
||||||
|
this.graph.onNodeConnectionChange(
|
||||||
|
LiteGraph.OUTPUT,
|
||||||
|
this,
|
||||||
|
slot,
|
||||||
|
target_node,
|
||||||
|
target_slot
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.setDirtyCanvas(false, true);
|
this.setDirtyCanvas(false, true);
|
||||||
this.graph.afterChange();
|
this.graph.afterChange();
|
||||||
|
|||||||
1170
build/litegraph.min.js
vendored
1170
build/litegraph.min.js
vendored
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user