+}
+
+/**
+ * Register the NodeOptions component instance
+ * @param instance - The NodeOptions component instance
+ */
+export function registerNodeOptionsInstance(
+ instance: null | NodeOptionsInstance
+) {
+ nodeOptionsInstance = instance
+}
+
/**
* Composable for managing the More Options menu configuration
* Refactored to use smaller, focused composables for better maintainability
@@ -181,6 +222,7 @@ export function useMoreOptionsMenu() {
menuOptions,
menuOptionsWithSubmenu,
bump,
- hasSubgraphs
+ hasSubgraphs,
+ registerNodeOptionsInstance
}
}
diff --git a/src/renderer/extensions/vueNodes/components/LGraphNode.vue b/src/renderer/extensions/vueNodes/components/LGraphNode.vue
index 402469324..9e4ecefd6 100644
--- a/src/renderer/extensions/vueNodes/components/LGraphNode.vue
+++ b/src/renderer/extensions/vueNodes/components/LGraphNode.vue
@@ -40,6 +40,7 @@
]"
v-bind="pointerHandlers"
@wheel="handleWheel"
+ @contextmenu="handleContextMenu"
>
@@ -135,6 +136,7 @@ import { storeToRefs } from 'pinia'
import { computed, inject, onErrorCaptured, onMounted, provide, ref } from 'vue'
import type { VueNodeData } from '@/composables/graph/useGraphNodeManager'
+import { toggleNodeOptions } from '@/composables/graph/useMoreOptionsMenu'
import { useErrorHandling } from '@/composables/useErrorHandling'
import { LiteGraph } from '@/lib/litegraph/src/litegraph'
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
@@ -175,8 +177,12 @@ const {
readonly = false
} = defineProps()
-const { handleNodeCollapse, handleNodeTitleUpdate, handleNodeSelect } =
- useNodeEventHandlers()
+const {
+ handleNodeCollapse,
+ handleNodeTitleUpdate,
+ handleNodeSelect,
+ handleNodeRightClick
+} = useNodeEventHandlers()
useVueElementTracking(() => nodeData.id, 'node')
@@ -235,6 +241,21 @@ const { pointerHandlers, isDragging, dragStyle } = useNodePointerInteractions(
handleNodeSelect
)
+// Handle right-click context menu
+const handleContextMenu = (event: MouseEvent) => {
+ event.preventDefault()
+ event.stopPropagation()
+
+ // First handle the standard right-click behavior (selection)
+ handleNodeRightClick(event as PointerEvent, nodeData)
+
+ // Show the node options menu at the cursor position
+ const targetElement = event.currentTarget as HTMLElement
+ if (targetElement) {
+ toggleNodeOptions(event, targetElement, false)
+ }
+}
+
onMounted(() => {
if (size.value && transformState?.camera) {
const scale = transformState.camera.z