Compare commits

...

1 Commits

Author SHA1 Message Date
filtered
68b5133b25 Reorder subgraph context menu items
- Follow-up on #4870

4870 is incomplete; the changes in this follow-up PR were what was tested, however the commit itself did not get pushed.
2025-08-12 04:22:03 +10:00

View File

@@ -191,7 +191,7 @@ export abstract class SubgraphIONodeBase<
* @param event The event that triggered the context menu. * @param event The event that triggered the context menu.
*/ */
protected showSlotContextMenu(slot: TSlot, event: CanvasPointerEvent): void { protected showSlotContextMenu(slot: TSlot, event: CanvasPointerEvent): void {
const options: IContextMenuValue[] = this.#getSlotMenuOptions(slot) const options = this.#getSlotMenuOptions(slot)
if (!(options.length > 0)) return if (!(options.length > 0)) return
new LiteGraph.ContextMenu(options, { new LiteGraph.ContextMenu(options, {
@@ -208,8 +208,8 @@ export abstract class SubgraphIONodeBase<
* @param slot The slot to get the context menu options for. * @param slot The slot to get the context menu options for.
* @returns The context menu options. * @returns The context menu options.
*/ */
#getSlotMenuOptions(slot: TSlot): IContextMenuValue[] { #getSlotMenuOptions(slot: TSlot): (IContextMenuValue | null)[] {
const options: IContextMenuValue[] = [] const options: (IContextMenuValue | null)[] = []
// Disconnect option if slot has connections // Disconnect option if slot has connections
if (slot !== this.emptySlot && slot.linkIds.length > 0) { if (slot !== this.emptySlot && slot.linkIds.length > 0) {
@@ -218,10 +218,10 @@ export abstract class SubgraphIONodeBase<
// Remove / rename slot option (except for the empty slot) // Remove / rename slot option (except for the empty slot)
if (slot !== this.emptySlot) { if (slot !== this.emptySlot) {
options.push( options.push({ content: 'Rename Slot', value: 'rename' }, null, {
{ content: 'Remove Slot', value: 'remove' }, content: 'Remove Slot',
{ content: 'Rename Slot', value: 'rename' } value: 'remove'
) })
} }
return options return options