double click feature is fixed

MODIFIED: separate into copy-full and copy-all
FIXED: improper size copying

https://github.com/ltdrdata/ComfyUI-Manager/issues/1118
This commit is contained in:
Dr.Lt.Data 2024-10-08 08:28:33 +09:00
parent 0469cad3bc
commit e9eaff7f7e
4 changed files with 15 additions and 7 deletions

View File

@ -23,7 +23,7 @@ sys.path.append(glob_path)
import cm_global
from manager_util import *
version = [2, 51, 4]
version = [2, 51, 5]
version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '')

View File

@ -982,6 +982,7 @@ class ManagerMenuDialog extends ComfyDialog {
dbl_click_policy_combo.className = "cm-menu-combo";
dbl_click_policy_combo.appendChild($el('option', { value: 'none', text: 'Double-Click: None' }, []));
dbl_click_policy_combo.appendChild($el('option', { value: 'copy-all', text: 'Double-Click: Copy All Connections' }, []));
dbl_click_policy_combo.appendChild($el('option', { value: 'copy-full', text: 'Double-Click: Copy All Connections and shapes' }, []));
dbl_click_policy_combo.appendChild($el('option', { value: 'copy-input', text: 'Double-Click: Copy Input Connections' }, []));
dbl_click_policy_combo.appendChild($el('option', { value: 'possible-input', text: 'Double-Click: Possible Input Connections' }, []));
dbl_click_policy_combo.appendChild($el('option', { value: 'dual', text: 'Double-Click: Possible(left) + Copy(right)' }, []));

View File

@ -101,7 +101,7 @@ function connect_inputs(nearest_inputs, node) {
}
}
function node_info_copy(src, dest, connect_both) {
function node_info_copy(src, dest, connect_both, copy_shape) {
// copy input connections
for(let i in src.inputs) {
let input = src.inputs[i];
@ -142,9 +142,11 @@ function node_info_copy(src, dest, connect_both) {
}
}
dest.color = src.color;
dest.bgcolor = src.bgcolor;
dest.size = src.size;
if(copy_shape) {
dest.color = src.color;
dest.bgcolor = src.bgcolor;
dest.size = max(src.size, dest.size);
}
app.graph.afterChange();
}
@ -162,6 +164,7 @@ app.registerExtension({
switch(double_click_policy) {
case "copy-all":
case "copy-full":
case "copy-input":
{
if(node.inputs?.some(x => x.link != null) || node.outputs?.some(x => x.links != null && x.links.length > 0) )
@ -169,7 +172,11 @@ app.registerExtension({
let src_node = lookup_nearest_nodes(node);
if(src_node)
node_info_copy(src_node, node, double_click_policy == "copy-all");
{
let both_connection = double_click_policy != "copy-input";
let copy_shape = double_click_policy == "copy-full";
node_info_copy(src_node, node, both_connection, copy_shape);
}
}
break;
case "possible-input":

View File

@ -1,7 +1,7 @@
[project]
name = "comfyui-manager"
description = "ComfyUI-Manager provides features to install and manage custom nodes for ComfyUI, as well as various functionalities to assist with ComfyUI."
version = "2.51.4"
version = "2.51.5"
license = { file = "LICENSE.txt" }
dependencies = ["GitPython", "PyGithub", "matrix-client==0.4.0", "transformers", "huggingface-hub>0.20", "typer", "rich", "typing-extensions"]