mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 10:42:44 +00:00
fix removeSlot error
This commit is contained in:
@@ -2359,6 +2359,7 @@ LGraphNode.prototype.addOutput = function(name,type,extra_info)
|
|||||||
if(this.onOutputAdded)
|
if(this.onOutputAdded)
|
||||||
this.onOutputAdded(o);
|
this.onOutputAdded(o);
|
||||||
this.size = this.computeSize();
|
this.size = this.computeSize();
|
||||||
|
this.setDirtyCanvas(true,true);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2385,6 +2386,7 @@ LGraphNode.prototype.addOutputs = function(array)
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.size = this.computeSize();
|
this.size = this.computeSize();
|
||||||
|
this.setDirtyCanvas(true,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2396,9 +2398,24 @@ LGraphNode.prototype.removeOutput = function(slot)
|
|||||||
{
|
{
|
||||||
this.disconnectOutput(slot);
|
this.disconnectOutput(slot);
|
||||||
this.outputs.splice(slot,1);
|
this.outputs.splice(slot,1);
|
||||||
|
for(var i = slot; i < this.outputs.length; ++i)
|
||||||
|
{
|
||||||
|
if( !this.outputs[i] || !this.outputs[i].links )
|
||||||
|
continue;
|
||||||
|
var links = this.outputs[i].links;
|
||||||
|
for(var j = 0; j < links.length; ++j)
|
||||||
|
{
|
||||||
|
var link = this.graph.links[ links[j] ];
|
||||||
|
if(!link)
|
||||||
|
continue;
|
||||||
|
link.origin_slot -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.size = this.computeSize();
|
this.size = this.computeSize();
|
||||||
if(this.onOutputRemoved)
|
if(this.onOutputRemoved)
|
||||||
this.onOutputRemoved(slot);
|
this.onOutputRemoved(slot);
|
||||||
|
this.setDirtyCanvas(true,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2422,6 +2439,7 @@ LGraphNode.prototype.addInput = function(name,type,extra_info)
|
|||||||
this.size = this.computeSize();
|
this.size = this.computeSize();
|
||||||
if(this.onInputAdded)
|
if(this.onInputAdded)
|
||||||
this.onInputAdded(o);
|
this.onInputAdded(o);
|
||||||
|
this.setDirtyCanvas(true,true);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2448,6 +2466,7 @@ LGraphNode.prototype.addInputs = function(array)
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.size = this.computeSize();
|
this.size = this.computeSize();
|
||||||
|
this.setDirtyCanvas(true,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2459,9 +2478,19 @@ LGraphNode.prototype.removeInput = function(slot)
|
|||||||
{
|
{
|
||||||
this.disconnectInput(slot);
|
this.disconnectInput(slot);
|
||||||
this.inputs.splice(slot,1);
|
this.inputs.splice(slot,1);
|
||||||
|
for(var i = slot; i < this.inputs.length; ++i)
|
||||||
|
{
|
||||||
|
if(!this.inputs[i])
|
||||||
|
continue;
|
||||||
|
var link = this.graph.links[ this.inputs[i].link ];
|
||||||
|
if(!link)
|
||||||
|
continue;
|
||||||
|
link.target_slot -= 1;
|
||||||
|
}
|
||||||
this.size = this.computeSize();
|
this.size = this.computeSize();
|
||||||
if(this.onInputRemoved)
|
if(this.onInputRemoved)
|
||||||
this.onInputRemoved(slot);
|
this.onInputRemoved(slot);
|
||||||
|
this.setDirtyCanvas(true,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6914,17 +6943,7 @@ LGraphCanvas.prototype.showSearchBox = function(event)
|
|||||||
if (that.onSearchBox){
|
if (that.onSearchBox){
|
||||||
that.onSearchBox(help, str, graphcanvas);
|
that.onSearchBox(help, str, graphcanvas);
|
||||||
} else {
|
} else {
|
||||||
function addResult(result) {
|
var c = 0;
|
||||||
var help = document.createElement("div");
|
|
||||||
if (!first) first = result;
|
|
||||||
help.innerText = result;
|
|
||||||
help.className = "litegraph lite-search-item";
|
|
||||||
help.addEventListener("click", function (e) {
|
|
||||||
select(this.innerText);
|
|
||||||
});
|
|
||||||
helper.appendChild(help);
|
|
||||||
}
|
|
||||||
let c = 0;
|
|
||||||
if(LGraphCanvas.search_filter) {
|
if(LGraphCanvas.search_filter) {
|
||||||
str = str.toLowerCase();
|
str = str.toLowerCase();
|
||||||
|
|
||||||
@@ -6934,17 +6953,30 @@ LGraphCanvas.prototype.showSearchBox = function(event)
|
|||||||
});
|
});
|
||||||
for(var i = 0; i < filtered.length; i++) {
|
for(var i = 0; i < filtered.length; i++) {
|
||||||
addResult(filtered[i]);
|
addResult(filtered[i]);
|
||||||
if(LGraphCanvas.search_limit !== -1 && c++ > LGraphCanvas.search_limit) break;
|
if(LGraphCanvas.search_limit !== -1 && c++ > LGraphCanvas.search_limit)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (var i in LiteGraph.registered_node_types) {
|
for (var i in LiteGraph.registered_node_types) {
|
||||||
if (i.indexOf(str) != -1) {
|
if (i.indexOf(str) != -1) {
|
||||||
addResult(i);
|
addResult(i);
|
||||||
if(LGraphCanvas.search_limit !== -1 && c++ > LGraphCanvas.search_limit) break;
|
if(LGraphCanvas.search_limit !== -1 && c++ > LGraphCanvas.search_limit)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addResult(result) {
|
||||||
|
var help = document.createElement("div");
|
||||||
|
if (!first) first = result;
|
||||||
|
help.innerText = result;
|
||||||
|
help.className = "litegraph lite-search-item";
|
||||||
|
help.addEventListener("click", function (e) {
|
||||||
|
select(this.innerText);
|
||||||
|
});
|
||||||
|
helper.appendChild(help);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return dialog;
|
return dialog;
|
||||||
|
|||||||
8877
build/litegraph.min.js
vendored
8877
build/litegraph.min.js
vendored
File diff suppressed because it is too large
Load Diff
@@ -2357,6 +2357,7 @@ LGraphNode.prototype.addOutput = function(name,type,extra_info)
|
|||||||
if(this.onOutputAdded)
|
if(this.onOutputAdded)
|
||||||
this.onOutputAdded(o);
|
this.onOutputAdded(o);
|
||||||
this.size = this.computeSize();
|
this.size = this.computeSize();
|
||||||
|
this.setDirtyCanvas(true,true);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2383,6 +2384,7 @@ LGraphNode.prototype.addOutputs = function(array)
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.size = this.computeSize();
|
this.size = this.computeSize();
|
||||||
|
this.setDirtyCanvas(true,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2394,9 +2396,24 @@ LGraphNode.prototype.removeOutput = function(slot)
|
|||||||
{
|
{
|
||||||
this.disconnectOutput(slot);
|
this.disconnectOutput(slot);
|
||||||
this.outputs.splice(slot,1);
|
this.outputs.splice(slot,1);
|
||||||
|
for(var i = slot; i < this.outputs.length; ++i)
|
||||||
|
{
|
||||||
|
if( !this.outputs[i] || !this.outputs[i].links )
|
||||||
|
continue;
|
||||||
|
var links = this.outputs[i].links;
|
||||||
|
for(var j = 0; j < links.length; ++j)
|
||||||
|
{
|
||||||
|
var link = this.graph.links[ links[j] ];
|
||||||
|
if(!link)
|
||||||
|
continue;
|
||||||
|
link.origin_slot -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.size = this.computeSize();
|
this.size = this.computeSize();
|
||||||
if(this.onOutputRemoved)
|
if(this.onOutputRemoved)
|
||||||
this.onOutputRemoved(slot);
|
this.onOutputRemoved(slot);
|
||||||
|
this.setDirtyCanvas(true,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2420,6 +2437,7 @@ LGraphNode.prototype.addInput = function(name,type,extra_info)
|
|||||||
this.size = this.computeSize();
|
this.size = this.computeSize();
|
||||||
if(this.onInputAdded)
|
if(this.onInputAdded)
|
||||||
this.onInputAdded(o);
|
this.onInputAdded(o);
|
||||||
|
this.setDirtyCanvas(true,true);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2446,6 +2464,7 @@ LGraphNode.prototype.addInputs = function(array)
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.size = this.computeSize();
|
this.size = this.computeSize();
|
||||||
|
this.setDirtyCanvas(true,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2457,9 +2476,19 @@ LGraphNode.prototype.removeInput = function(slot)
|
|||||||
{
|
{
|
||||||
this.disconnectInput(slot);
|
this.disconnectInput(slot);
|
||||||
this.inputs.splice(slot,1);
|
this.inputs.splice(slot,1);
|
||||||
|
for(var i = slot; i < this.inputs.length; ++i)
|
||||||
|
{
|
||||||
|
if(!this.inputs[i])
|
||||||
|
continue;
|
||||||
|
var link = this.graph.links[ this.inputs[i].link ];
|
||||||
|
if(!link)
|
||||||
|
continue;
|
||||||
|
link.target_slot -= 1;
|
||||||
|
}
|
||||||
this.size = this.computeSize();
|
this.size = this.computeSize();
|
||||||
if(this.onInputRemoved)
|
if(this.onInputRemoved)
|
||||||
this.onInputRemoved(slot);
|
this.onInputRemoved(slot);
|
||||||
|
this.setDirtyCanvas(true,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6912,17 +6941,7 @@ LGraphCanvas.prototype.showSearchBox = function(event)
|
|||||||
if (that.onSearchBox){
|
if (that.onSearchBox){
|
||||||
that.onSearchBox(help, str, graphcanvas);
|
that.onSearchBox(help, str, graphcanvas);
|
||||||
} else {
|
} else {
|
||||||
function addResult(result) {
|
var c = 0;
|
||||||
var help = document.createElement("div");
|
|
||||||
if (!first) first = result;
|
|
||||||
help.innerText = result;
|
|
||||||
help.className = "litegraph lite-search-item";
|
|
||||||
help.addEventListener("click", function (e) {
|
|
||||||
select(this.innerText);
|
|
||||||
});
|
|
||||||
helper.appendChild(help);
|
|
||||||
}
|
|
||||||
let c = 0;
|
|
||||||
if(LGraphCanvas.search_filter) {
|
if(LGraphCanvas.search_filter) {
|
||||||
str = str.toLowerCase();
|
str = str.toLowerCase();
|
||||||
|
|
||||||
@@ -6932,17 +6951,30 @@ LGraphCanvas.prototype.showSearchBox = function(event)
|
|||||||
});
|
});
|
||||||
for(var i = 0; i < filtered.length; i++) {
|
for(var i = 0; i < filtered.length; i++) {
|
||||||
addResult(filtered[i]);
|
addResult(filtered[i]);
|
||||||
if(LGraphCanvas.search_limit !== -1 && c++ > LGraphCanvas.search_limit) break;
|
if(LGraphCanvas.search_limit !== -1 && c++ > LGraphCanvas.search_limit)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (var i in LiteGraph.registered_node_types) {
|
for (var i in LiteGraph.registered_node_types) {
|
||||||
if (i.indexOf(str) != -1) {
|
if (i.indexOf(str) != -1) {
|
||||||
addResult(i);
|
addResult(i);
|
||||||
if(LGraphCanvas.search_limit !== -1 && c++ > LGraphCanvas.search_limit) break;
|
if(LGraphCanvas.search_limit !== -1 && c++ > LGraphCanvas.search_limit)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addResult(result) {
|
||||||
|
var help = document.createElement("div");
|
||||||
|
if (!first) first = result;
|
||||||
|
help.innerText = result;
|
||||||
|
help.className = "litegraph lite-search-item";
|
||||||
|
help.addEventListener("click", function (e) {
|
||||||
|
select(this.innerText);
|
||||||
|
});
|
||||||
|
helper.appendChild(help);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return dialog;
|
return dialog;
|
||||||
|
|||||||
Reference in New Issue
Block a user