From 9f3245d9f0043b87a3d4b8aa111264a228286efc Mon Sep 17 00:00:00 2001 From: Michael Poutre Date: Sun, 30 Apr 2023 22:40:02 -0700 Subject: [PATCH] refactor: Only show Align options if more than one node is selected --- src/litegraph.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/litegraph.js b/src/litegraph.js index e61b781c7c..043df4d886 100755 --- a/src/litegraph.js +++ b/src/litegraph.js @@ -12977,7 +12977,6 @@ LGraphNode.prototype.executeAction = function(action) callback: LGraphCanvas.onMenuAdd }, { content: "Add Group", callback: LGraphCanvas.onGroupAdd }, - { content: "Align", has_submenu: true, callback: LGraphCanvas.onGroupAlign }, //{ content: "Arrange", callback: that.graph.arrange }, //{content:"Collapse All", callback: LGraphCanvas.onMenuCollapseAll } ]; @@ -12985,6 +12984,14 @@ LGraphNode.prototype.executeAction = function(action) options.push({ content: "Options", callback: that.showShowGraphOptionsPanel }); }*/ + if (Object.keys(this.selected_nodes).length > 1) { + options.push({ + content: "Align", + has_submenu: true, + callback: LGraphCanvas.onGroupAlign, + }) + } + if (this._graph_stack && this._graph_stack.length > 0) { options.push(null, { content: "Close subgraph",