Skip to content

How to add a contextual menu to a node ? #190

Answered by bcakmakoglu
clabnet asked this question in Q&A
Discussion options

You must be logged in to vote

@clabnet I checked the component you linked and you just have to stop the propagation of the click - otherwise "vue-simple-context-menu" believes there was a click outside and immediately closes the context menu again

So you can just do something like this

onNodeClick(({ event }) => {
  event.stopImmediatePropagation()
  vueSimpleContextMenu.value.showMenu(event, { name: 'foo' })
})

You have to be aware though that this component will not scale by itself (when you scroll to zoom in and out, the context menu stays the same size)

You can "fix" that by using the menu in your node component but that will cause the context menu to appear somewhere different than the node, simply because "vue-s…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by bcakmakoglu
Comment options

You must be logged in to vote
4 replies
@bcakmakoglu
Comment options

@kvedula18
Comment options

@kvedula18
Comment options

@bcakmakoglu
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
3 participants