Add connected node selected index highlight

This commit is contained in:
Palazzini Luca
2024-09-16 11:06:12 +02:00
parent bfb15faaae
commit 5408eb3818
2 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui-visualarea-nodes"
description = "This is a collection of nodes created to aid when managing area conditionings."
version = "1.0.7"
version = "1.0.8"
license = {file = "LICENSE"}
[project.urls]
+12
View File
@@ -120,6 +120,18 @@ export function addAreaGraphWidget(node) {
const [x, y, w, h] = getDrawArea(values[node.index]);
drawRect(widgetX + x, widgetYOffset + y, w, h, generateHslColor(node.index + 1, values.length, 1.0, 30));
drawRect(widgetX + x + halfBorder, widgetYOffset + y + halfBorder, w - AREA_BORDER_SIZE, h - AREA_BORDER_SIZE, generateHslColor(node.index + 1, values.length));
if (node.is_selected) {
node.inputs.filter(input => input.name.includes(node.index)).forEach(input => {
const link = input.link;
if (link) {
const nodeId = node.graph.links[link].origin_id;
const connectedNode = node.graph._nodes_by_id[nodeId];
const [x, y] = connectedNode.pos;
const [w, h] = connectedNode.size;
drawRect(x - node.pos[0], y - node.pos[1], w, h, generateHslColor(node.index + 1, values.length, 0.5));
}
});
}
}
}
widget.canvas = document.createElement("canvas");