mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 19:21:54 +00:00
Merge pull request #124 from sker65/master
Added hook for slot context menu
This commit is contained in:
1
src/litegraph.d.ts
vendored
1
src/litegraph.d.ts
vendored
@@ -944,6 +944,7 @@ export declare class LGraphNode {
|
|||||||
|
|
||||||
/** Called by `LGraphCanvas.processContextMenu` */
|
/** Called by `LGraphCanvas.processContextMenu` */
|
||||||
getMenuOptions?(graphCanvas: LGraphCanvas): ContextMenuItem[];
|
getMenuOptions?(graphCanvas: LGraphCanvas): ContextMenuItem[];
|
||||||
|
getSlotMenuOptions?(slot: INodeSlot): ContextMenuItem[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export type LGraphNodeConstructor<T extends LGraphNode = LGraphNode> = {
|
export type LGraphNodeConstructor<T extends LGraphNode = LGraphNode> = {
|
||||||
|
|||||||
@@ -10082,25 +10082,30 @@ LGraphNode.prototype.executeAction = function(action)
|
|||||||
if (slot) {
|
if (slot) {
|
||||||
//on slot
|
//on slot
|
||||||
menu_info = [];
|
menu_info = [];
|
||||||
if (
|
if (node.getSlotMenuOptions) {
|
||||||
slot &&
|
menu_info = node.getSlotMenuOptions(slot);
|
||||||
slot.output &&
|
} else {
|
||||||
slot.output.links &&
|
if (
|
||||||
slot.output.links.length
|
slot &&
|
||||||
) {
|
slot.output &&
|
||||||
menu_info.push({ content: "Disconnect Links", slot: slot });
|
slot.output.links &&
|
||||||
|
slot.output.links.length
|
||||||
|
) {
|
||||||
|
menu_info.push({ content: "Disconnect Links", slot: slot });
|
||||||
|
}
|
||||||
|
var _slot = slot.input || slot.output;
|
||||||
|
menu_info.push(
|
||||||
|
_slot.locked
|
||||||
|
? "Cannot remove"
|
||||||
|
: { content: "Remove Slot", slot: slot }
|
||||||
|
);
|
||||||
|
menu_info.push(
|
||||||
|
_slot.nameLocked
|
||||||
|
? "Cannot rename"
|
||||||
|
: { content: "Rename Slot", slot: slot }
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
var _slot = slot.input || slot.output;
|
|
||||||
menu_info.push(
|
|
||||||
_slot.locked
|
|
||||||
? "Cannot remove"
|
|
||||||
: { content: "Remove Slot", slot: slot }
|
|
||||||
);
|
|
||||||
menu_info.push(
|
|
||||||
_slot.nameLocked
|
|
||||||
? "Cannot rename"
|
|
||||||
: { content: "Rename Slot", slot: slot }
|
|
||||||
);
|
|
||||||
options.title =
|
options.title =
|
||||||
(slot.input ? slot.input.type : slot.output.type) || "*";
|
(slot.input ? slot.input.type : slot.output.type) || "*";
|
||||||
if (slot.input && slot.input.type == LiteGraph.ACTION) {
|
if (slot.input && slot.input.type == LiteGraph.ACTION) {
|
||||||
|
|||||||
Reference in New Issue
Block a user