mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2026-05-21 11:17:22 +08:00
Update contextmenu.js
This commit is contained in:
parent
51e792ccdf
commit
02c76c88b4
@ -48,11 +48,28 @@ app.registerExtension({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async setup(app) {
|
async setup(app) {
|
||||||
const onChange = (value) => {
|
const updateSlots = (value) => {
|
||||||
if (value!="disabled") {
|
const valuesToAddToIn = ["GetNode"];
|
||||||
const valuesToAddToIn = ["GetNode"];
|
const valuesToAddToOut = ["SetNode"];
|
||||||
const valuesToAddToOut = ["SetNode"];
|
// Remove entries if they exist
|
||||||
|
for (const arr of Object.values(LiteGraph.slot_types_default_in)) {
|
||||||
|
for (const valueToAdd of valuesToAddToIn) {
|
||||||
|
const idx = arr.indexOf(valueToAdd);
|
||||||
|
if (idx !== -1) {
|
||||||
|
arr.splice(idx, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const arr of Object.values(LiteGraph.slot_types_default_out)) {
|
||||||
|
for (const valueToAdd of valuesToAddToOut) {
|
||||||
|
const idx = arr.indexOf(valueToAdd);
|
||||||
|
if (idx !== -1) {
|
||||||
|
arr.splice(idx, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (value!="disabled") {
|
||||||
for (const arr of Object.values(LiteGraph.slot_types_default_in)) {
|
for (const arr of Object.values(LiteGraph.slot_types_default_in)) {
|
||||||
for (const valueToAdd of valuesToAddToIn) {
|
for (const valueToAdd of valuesToAddToIn) {
|
||||||
const idx = arr.indexOf(valueToAdd);
|
const idx = arr.indexOf(valueToAdd);
|
||||||
@ -90,7 +107,7 @@ app.registerExtension({
|
|||||||
options: ['disabled', 'top', 'bottom'],
|
options: ['disabled', 'top', 'bottom'],
|
||||||
defaultValue: 'disabled',
|
defaultValue: 'disabled',
|
||||||
type: "combo",
|
type: "combo",
|
||||||
onChange: onChange,
|
onChange: updateSlots,
|
||||||
|
|
||||||
});
|
});
|
||||||
app.ui.settings.addSetting({
|
app.ui.settings.addSetting({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user