From e9eaff7f7e4a7c06550ce87c7a08e9aed496885e Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" Date: Tue, 8 Oct 2024 08:28:33 +0900 Subject: [PATCH] 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 --- glob/manager_core.py | 2 +- js/comfyui-manager.js | 1 + js/node_fixer.js | 17 ++++++++++++----- pyproject.toml | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/glob/manager_core.py b/glob/manager_core.py index 34036199..30d1f862 100644 --- a/glob/manager_core.py +++ b/glob/manager_core.py @@ -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 '') diff --git a/js/comfyui-manager.js b/js/comfyui-manager.js index ac88d9e9..37ea6d2c 100644 --- a/js/comfyui-manager.js +++ b/js/comfyui-manager.js @@ -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)' }, [])); diff --git a/js/node_fixer.js b/js/node_fixer.js index f83022f5..9cb0dac6 100644 --- a/js/node_fixer.js +++ b/js/node_fixer.js @@ -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": diff --git a/pyproject.toml b/pyproject.toml index 85c1a0dd..ad9f0c61 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"]