MCPcopy Create free account
hub / github.com/Comfy-Org/litegraph.js / getNodeMenuOptions

Method getNodeMenuOptions

src/LGraphCanvas.ts:7477–7600  ·  view source on GitHub ↗
(node: LGraphNode)

Source from the content-addressed store, hash-verified

7475
7476 // called by processContextMenu to extract the menu list
7477 getNodeMenuOptions(node: LGraphNode) {
7478 let options: (IContextMenuValue<string> | IContextMenuValue<string | null> | IContextMenuValue<INodeSlotContextItem> | IContextMenuValue<unknown, LGraphNode> | IContextMenuValue<typeof LiteGraph.VALID_SHAPES[number]> | null)[]
7479
7480 if (node.getMenuOptions) {
7481 options = node.getMenuOptions(this)
7482 } else {
7483 options = [
7484 {
7485 content: "Inputs",
7486 has_submenu: true,
7487 disabled: true,
7488 },
7489 {
7490 content: "Outputs",
7491 has_submenu: true,
7492 disabled: true,
7493 callback: LGraphCanvas.showMenuNodeOptionalOutputs,
7494 },
7495 null,
7496 {
7497 content: "Convert to Subgraph 🆕",
7498 callback: () => {
7499 if (!this.selectedItems.size) throw new Error("Convert to Subgraph: Nothing selected.")
7500 this._graph.convertToSubgraph(this.selectedItems)
7501 },
7502 },
7503 {
7504 content: "Properties",
7505 has_submenu: true,
7506 callback: LGraphCanvas.onShowMenuNodeProperties,
7507 },
7508 {
7509 content: "Properties Panel",
7510 callback: function (item: any, options: any, e: any, menu: any, node: LGraphNode) { LGraphCanvas.active_canvas.showShowNodePanel(node) },
7511 },
7512 null,
7513 {
7514 content: "Title",
7515 callback: LGraphCanvas.onShowPropertyEditor,
7516 },
7517 {
7518 content: "Mode",
7519 has_submenu: true,
7520 callback: LGraphCanvas.onMenuNodeMode,
7521 },
7522 ]
7523 if (node.resizable !== false) {
7524 options.push({
7525 content: "Resize",
7526 callback: LGraphCanvas.onMenuResizeNode,
7527 })
7528 }
7529 if (node.collapsible) {
7530 options.push({
7531 content: node.collapsed ? "Expand" : "Collapse",
7532 callback: LGraphCanvas.onMenuNodeCollapse,
7533 })
7534 }

Callers 1

processContextMenuMethod · 0.95

Calls 5

setDirtyMethod · 0.95
getMenuOptionsMethod · 0.80
convertToSubgraphMethod · 0.80
showShowNodePanelMethod · 0.80
pinMethod · 0.65

Tested by

no test coverage detected