Spaces:
Running
on
Zero
Running
on
Zero
File size: 1,877 Bytes
4450790 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
import { app } from "../../scripts/app.js";
import { rgthreeApi } from "../../rgthree/common/rgthree_api.js";
const PASS_THROUGH = function (item) {
return item;
};
export async function showLoraChooser(event, callback, parentMenu, loras) {
var _a, _b;
const canvas = app.canvas;
if (!loras) {
loras = ["None", ...(await rgthreeApi.getLoras())];
}
new LiteGraph.ContextMenu(loras, {
event: event,
parentMenu,
title: "Choose a lora",
scale: Math.max(1, (_b = (_a = canvas.ds) === null || _a === void 0 ? void 0 : _a.scale) !== null && _b !== void 0 ? _b : 1),
className: "dark",
callback,
});
}
export function showNodesChooser(event, mapFn, callback, parentMenu) {
var _a, _b;
const canvas = app.canvas;
const nodesOptions = app.graph._nodes
.map(mapFn)
.filter((e) => e != null);
nodesOptions.sort((a, b) => {
return a.value - b.value;
});
new LiteGraph.ContextMenu(nodesOptions, {
event: event,
parentMenu,
title: "Choose a node id",
scale: Math.max(1, (_b = (_a = canvas.ds) === null || _a === void 0 ? void 0 : _a.scale) !== null && _b !== void 0 ? _b : 1),
className: "dark",
callback,
});
}
export function showWidgetsChooser(event, node, mapFn, callback, parentMenu) {
var _a, _b;
const options = (node.widgets || [])
.map(mapFn)
.filter((e) => e != null);
if (options.length) {
const canvas = app.canvas;
new LiteGraph.ContextMenu(options, {
event,
parentMenu,
title: "Choose an input/widget",
scale: Math.max(1, (_b = (_a = canvas.ds) === null || _a === void 0 ? void 0 : _a.scale) !== null && _b !== void 0 ? _b : 1),
className: "dark",
callback,
});
}
}
|