mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2025-12-08 20:34:35 +08:00
Update contextmenu.js
This commit is contained in:
parent
51e792ccdf
commit
02c76c88b4
@ -48,11 +48,28 @@ app.registerExtension({
|
||||
}
|
||||
},
|
||||
async setup(app) {
|
||||
const onChange = (value) => {
|
||||
if (value!="disabled") {
|
||||
const valuesToAddToIn = ["GetNode"];
|
||||
const valuesToAddToOut = ["SetNode"];
|
||||
const updateSlots = (value) => {
|
||||
const valuesToAddToIn = ["GetNode"];
|
||||
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 valueToAdd of valuesToAddToIn) {
|
||||
const idx = arr.indexOf(valueToAdd);
|
||||
@ -90,7 +107,7 @@ app.registerExtension({
|
||||
options: ['disabled', 'top', 'bottom'],
|
||||
defaultValue: 'disabled',
|
||||
type: "combo",
|
||||
onChange: onChange,
|
||||
onChange: updateSlots,
|
||||
|
||||
});
|
||||
app.ui.settings.addSetting({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user