mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2025-12-14 15:24:34 +08:00
Update setgetnodes.js
This commit is contained in:
parent
1f6dfab05d
commit
b4480e0ccc
@ -43,6 +43,7 @@ app.registerExtension({
|
|||||||
currentGetters = null;
|
currentGetters = null;
|
||||||
slotColor = "#FFF";
|
slotColor = "#FFF";
|
||||||
canvas = app.canvas;
|
canvas = app.canvas;
|
||||||
|
menuEntry = "Show connections";
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
if (!this.properties) {
|
if (!this.properties) {
|
||||||
@ -219,20 +220,49 @@ app.registerExtension({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
getExtraMenuOptions(_, options) {
|
getExtraMenuOptions(_, options) {
|
||||||
let menuEntry = this.drawConnection ? "Hide connections" : "Show connections";
|
this.menuEntry = this.drawConnection ? "Hide connections" : "Show connections";
|
||||||
options.unshift(
|
options.unshift(
|
||||||
{
|
{
|
||||||
content: menuEntry,
|
content: this.menuEntry,
|
||||||
callback: () => {
|
callback: () => {
|
||||||
this.currentGetters = this.findGetters(this.graph);
|
this.currentGetters = this.findGetters(this.graph);
|
||||||
if (this.currentGetters.length == 0) return;
|
if (this.currentGetters.length == 0) return;
|
||||||
let linkType = (this.currentGetters[0].outputs[0].type);
|
let linkType = (this.currentGetters[0].outputs[0].type);
|
||||||
this.slotColor = this.canvas.default_connection_color_byType[linkType]
|
this.slotColor = this.canvas.default_connection_color_byType[linkType]
|
||||||
menuEntry = this.drawConnection ? "Hide connections" : "Show connections";
|
this.menuEntry = this.drawConnection ? "Hide connections" : "Show connections";
|
||||||
this.drawConnection = !this.drawConnection;
|
this.drawConnection = !this.drawConnection;
|
||||||
this.canvas.setDirty(true, true);
|
this.canvas.setDirty(true, true);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
has_submenu: true,
|
||||||
|
submenu: {
|
||||||
|
title: "Color",
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
content: "Highlight",
|
||||||
|
callback: () => {
|
||||||
|
this.slotColor = "orange"
|
||||||
|
this.canvas.setDirty(true, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
content: "Hide all connections",
|
||||||
|
callback: () => {
|
||||||
|
const allGetters = this.graph._nodes.filter(otherNode => otherNode.type === "GetNode" || otherNode.type === "SetNode");
|
||||||
|
allGetters.forEach(otherNode => {
|
||||||
|
otherNode.drawConnection = false;
|
||||||
|
console.log(otherNode);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.menuEntry = "Show connections";
|
||||||
|
this.drawConnection = false
|
||||||
|
this.canvas.setDirty(true, true);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
// Dynamically add a submenu for all getters
|
// Dynamically add a submenu for all getters
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user