From 014af1c8bf279698d0a44fb963c443bc54385eab Mon Sep 17 00:00:00 2001 From: youyegit <131540443+youyegit@users.noreply.github.com> Date: Sat, 12 Oct 2024 12:09:48 +0800 Subject: [PATCH 1/4] Enables the configuration to use relative paths --- py/workflows.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/py/workflows.py b/py/workflows.py index ade13a1..233e8c8 100644 --- a/py/workflows.py +++ b/py/workflows.py @@ -12,6 +12,8 @@ root_directory = os.path.dirname(inspect.getfile(PromptServer)) workflows_directory = os.path.join(root_directory, "pysssss-workflows") workflows_directory = pysssss.get_config_value( "workflows.directory", workflows_directory) +if not os.path.isabs(workflows_directory): + workflows_directory = os.path.abspath(os.path.join(root_directory, workflows_directory)) NODE_CLASS_MAPPINGS = {} NODE_DISPLAY_NAME_MAPPINGS = {} From c602f3f4c4b3a3278eca4e2276a396c6069950eb Mon Sep 17 00:00:00 2001 From: Kathleen-Xu <73981758+Kathleen-Xu@users.noreply.github.com> Date: Fri, 18 Oct 2024 17:59:39 +0800 Subject: [PATCH 2/4] fix background when export image --- web/js/workflowImage.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web/js/workflowImage.js b/web/js/workflowImage.js index e9869e4..33e4dce 100644 --- a/web/js/workflowImage.js +++ b/web/js/workflowImage.js @@ -50,10 +50,12 @@ class WorkflowImage { } updateView(bounds) { + const scale = window.devicePixelRatio || 1; app.canvas.ds.scale = 1; - app.canvas.canvas.width = bounds[2] - bounds[0]; - app.canvas.canvas.height = bounds[3] - bounds[1]; - app.canvas.ds.offset = [-bounds[0], -bounds[1]]; + app.canvas.canvas.width = (bounds[2] - bounds[0]) * scale; + app.canvas.canvas.height = (bounds[3] - bounds[1]) * scale; + app.canvas.ds.offset = [-bounds[0] * scale, -bounds[1] * scale]; + app.canvas.canvas.getContext("2d").setTransform(scale, 0, 0, scale, 0, 0); } getDrawTextConfig(_, widget) { From 24770ab7cc2bbb3d51d626ce4101500d23ef4525 Mon Sep 17 00:00:00 2001 From: huchenlei Date: Thu, 24 Oct 2024 07:56:56 -0400 Subject: [PATCH 3/4] Fix snap guide enable condition --- web/js/snapToGridGuide.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/js/snapToGridGuide.js b/web/js/snapToGridGuide.js index 75a975a..54a8a0c 100644 --- a/web/js/snapToGridGuide.js +++ b/web/js/snapToGridGuide.js @@ -97,11 +97,16 @@ const ext = { } }); + const alwaysSnapToGrid = () => + app.ui.settings.getSettingValue("pysssss.SnapToGrid", /* default=*/ false); + const snapToGridEnabled = () => + app.shiftDown || alwaysSnapToGrid(); + // Override drag-and-drop behavior to show orthogonal guide lines around selected node(s) and preview of where the node(s) will be placed - const origDrawNode = LGraphCanvas.prototype.drawNode + const origDrawNode = LGraphCanvas.prototype.drawNode; LGraphCanvas.prototype.drawNode = function (node, ctx) { const enabled = guide_config.lines.enabled || guide_config.block.enabled; - if (enabled && app.shiftDown && this.node_dragged && node.id in this.selected_nodes) { + if (enabled && this.node_dragged && node.id in this.selected_nodes && snapToGridEnabled()) { // discretize the canvas into grid let x = LiteGraph.CANVAS_GRID_SIZE * Math.round(node.pos[0] / LiteGraph.CANVAS_GRID_SIZE); let y = LiteGraph.CANVAS_GRID_SIZE * Math.round(node.pos[1] / LiteGraph.CANVAS_GRID_SIZE); From 9b791817e145f6f9d915b8ba534da6f46f4653c2 Mon Sep 17 00:00:00 2001 From: Kathleen-Xu <73981758+Kathleen-Xu@users.noreply.github.com> Date: Thu, 7 Nov 2024 09:42:37 +0800 Subject: [PATCH 4/4] fix: the offset should not be multiplied by the scale --- web/js/workflowImage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/js/workflowImage.js b/web/js/workflowImage.js index 33e4dce..c2f2b80 100644 --- a/web/js/workflowImage.js +++ b/web/js/workflowImage.js @@ -54,7 +54,7 @@ class WorkflowImage { app.canvas.ds.scale = 1; app.canvas.canvas.width = (bounds[2] - bounds[0]) * scale; app.canvas.canvas.height = (bounds[3] - bounds[1]) * scale; - app.canvas.ds.offset = [-bounds[0] * scale, -bounds[1] * scale]; + app.canvas.ds.offset = [-bounds[0], -bounds[1]]; app.canvas.canvas.getContext("2d").setTransform(scale, 0, 0, scale, 0, 0); }