mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2025-12-17 02:12:58 +08:00
improve: double-click options
- better possible input connections update README.md
This commit is contained in:
parent
b5cde5936f
commit
048f44f105
11
README.md
11
README.md
@ -257,9 +257,14 @@ NODE_CLASS_MAPPINGS.update({
|
||||
## Additional Feature
|
||||
* Fix node(recreate): When right-clicking on a node and selecting `Fix node (recreate)`, you can recreate the node. The widget's values are reset, while the connections maintain those with the same names.
|
||||
* It is used to correct errors in nodes of old workflows created before, which are incompatible with the version changes of custom nodes.
|
||||
* Connection copy: Double-clicking a node copies the connections of the nearest node.
|
||||
* However, this action is only possible when there are no existing connections, and since duplicate connections are not allowed in the output, connections from the existing node's output will disappear.
|
||||
* This feature copies only the input and output that match the names.
|
||||
* Double-Click: You can set the double click behavior of nodes in the ComfyUI-Manager menu.
|
||||
* `Copy All Connections`, `Copy Input Connections`: Double-clicking a node copies the connections of the nearest node.
|
||||
* This action targets the nearest node within a straight-line distance of 1000 pixels from the center of the node.
|
||||
* In the case of `Copy All Connections`, it duplicates existing outputs, but since it does not allow duplicate connections, the existing output connections of the original node are disconnected.
|
||||
* This feature copies only the input and output that match the names.
|
||||
|
||||
* `Possible Input Connections`: It connects all outputs that match the closest type within the specified range.
|
||||
* This connection links to the closest outputs among the nodes located on the left side of the target node.
|
||||
|
||||
## Troubleshooting
|
||||
* If your `git.exe` is installed in a specific location other than system git, please install ComfyUI-Manager and run ComfyUI. Then, specify the path including the file name in `git_exe = ` in the ComfyUI-Manager/config.ini file that is generated.
|
||||
|
||||
@ -21,15 +21,12 @@ function addMenuHandler(nodeType, cb) {
|
||||
}
|
||||
|
||||
function distance(node1, node2) {
|
||||
let dx = node1.pos[0] - node2.pos[0];
|
||||
let dy = node1.pos[1] - node2.pos[1];
|
||||
let dx = (node1.pos[0] + node1.size[0]/2) - (node2.pos[0] + node2.size[0]/2);
|
||||
let dy = (node1.pos[1] + node1.size[1]/2) - (node2.pos[1] + node2.size[1]/2);
|
||||
return Math.sqrt(dx * dx + dy * dy);
|
||||
}
|
||||
|
||||
function lookup_nearest_nodes(node) {
|
||||
let x = node.pos[0] + node.size[0]/2;
|
||||
let y = node.pos[1] + node.size[1]/2;
|
||||
|
||||
let nearest_distance = Infinity;
|
||||
let nearest_node = null;
|
||||
for(let other of app.graph._nodes) {
|
||||
@ -52,20 +49,26 @@ function lookup_nearest_inputs(node) {
|
||||
for(let i in node.inputs) {
|
||||
let input = node.inputs[i];
|
||||
|
||||
if(input_map[input.type])
|
||||
if(input.link || input_map[input.type])
|
||||
continue;
|
||||
|
||||
input_map[input.type] = {distance: Infinity, input_name: input.name, node: null, slot: null};
|
||||
}
|
||||
|
||||
let x = node.pos[0] + node.size[0]/2;
|
||||
let x = node.pos[0];
|
||||
let y = node.pos[1] + node.size[1]/2;
|
||||
|
||||
for(let other of app.graph._nodes) {
|
||||
if(other === node || !other.outputs)
|
||||
continue;
|
||||
|
||||
let dist = distance(node, other);
|
||||
let dx = x - (other.pos[0] + other.size[0]);
|
||||
let dy = y - (other.pos[1] + other.size[1]/2);
|
||||
|
||||
if(dx < 0)
|
||||
continue;
|
||||
|
||||
let dist = Math.sqrt(dx * dx + dy * dy);
|
||||
|
||||
for(let input_type in input_map) {
|
||||
for(let j in other.outputs) {
|
||||
@ -146,9 +149,6 @@ app.registerExtension({
|
||||
node.onDblClick = () => {
|
||||
orig_dblClick?.apply?.(this, arguments);
|
||||
|
||||
if(node.inputs?.some(x => x.link != null) || node.outputs?.some(x => x.links != null && x.links.length > 0) )
|
||||
return;
|
||||
|
||||
if(!node.inputs && !node.outputs)
|
||||
return;
|
||||
|
||||
@ -156,6 +156,9 @@ app.registerExtension({
|
||||
case "copy-all":
|
||||
case "copy-input":
|
||||
{
|
||||
if(node.inputs?.some(x => x.link != null) || node.outputs?.some(x => x.links != null && x.links.length > 0) )
|
||||
return;
|
||||
|
||||
let src_node = lookup_nearest_nodes(node);
|
||||
if(src_node)
|
||||
node_info_copy(src_node, node, double_click_policy == "copy-all");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user