Migrate groupOptions (#37)

* rename

* migrate
This commit is contained in:
Chenlei Hu
2024-06-18 15:27:46 -04:00
committed by GitHub
parent 641c0fa01f
commit 917d6cc494

View File

@@ -63,8 +63,10 @@ function addNodesToGroup(group, nodes=[]) {
app.registerExtension({
name: "Comfy.GroupOptions",
setup() {
// @ts-ignore
const orig = LGraphCanvas.prototype.getCanvasMenuOptions;
// graph_mouse
// @ts-ignore
LGraphCanvas.prototype.getCanvasMenuOptions = function () {
const options = orig.apply(this, arguments);
const group = this.graph.getGroupOnPos(this.graph_mouse[0], this.graph_mouse[1]);
@@ -73,6 +75,7 @@ app.registerExtension({
content: "Add Group For Selected Nodes",
disabled: !Object.keys(app.canvas.selected_nodes || {}).length,
callback: () => {
// @ts-ignore
var group = new LiteGraph.LGraphGroup();
addNodesToGroup(group, this.selected_nodes)
app.canvas.graph.add(group);