Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/graph/NodeContextMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ function onMenuHide() {
}

onMounted(() => {
registerNodeOptionsInstance({ toggle, hide, isOpen })
registerNodeOptionsInstance({ toggle, show, hide, isOpen })
})

onUnmounted(() => {
Expand Down
12 changes: 12 additions & 0 deletions src/composables/graph/useMoreOptionsMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,23 @@ export function toggleNodeOptions(event: Event) {
}
}

/**
* Show the node options popover (always shows, doesn't toggle)
* Use this for contextmenu events where we always want to show at the new position
* @param event - The trigger event (must be MouseEvent for position)
*/
export function showNodeOptions(event: MouseEvent) {
if (nodeOptionsInstance?.show) {
nodeOptionsInstance.show(event)
}
Comment on lines +64 to +66
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional:

Suggested change
if (nodeOptionsInstance?.show) {
nodeOptionsInstance.show(event)
}
nodeOptionsInstance?.show?.(event)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the nodeOptionsInstance possibly undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possibly null cos it uses some form of registration

}

/**
* Hide the node options popover
*/
interface NodeOptionsInstance {
toggle: (event: Event) => void
show: (event: MouseEvent) => void
hide: () => void
isOpen: Ref<boolean>
}
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/extensions/vueNodes/components/LGraphNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ import { computed, nextTick, onErrorCaptured, onMounted, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'

import type { VueNodeData } from '@/composables/graph/useGraphNodeManager'
import { toggleNodeOptions } from '@/composables/graph/useMoreOptionsMenu'
import { showNodeOptions } from '@/composables/graph/useMoreOptionsMenu'
import { useErrorHandling } from '@/composables/useErrorHandling'
import { st } from '@/i18n'
import {
Expand Down Expand Up @@ -290,7 +290,7 @@ const handleContextMenu = (event: MouseEvent) => {
handleNodeRightClick(event as PointerEvent, nodeData.id)

// Show the node options menu at the cursor position
toggleNodeOptions(event)
showNodeOptions(event)
}

onMounted(() => {
Expand Down
Loading