refactor: Only show Align options if more than one node is selected

This commit is contained in:
Michael Poutre
2023-04-30 22:40:02 -07:00
parent badf134f12
commit 9f3245d9f0

View File

@@ -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",