Skip to content

Connection Plugin: Detect if target is a socket in connectiondrop #570

Answered by kh-viewar
kh-viewar asked this question in Q&A
Discussion options

You must be logged in to vote

FYI why I need this: I want to create a new node programatically (without context menu) if user drops a connection in to free space. That's why I need to know if connectiondrop has happened on a socket or not.

My first intention was to to fork rete-connection-plugin and change the connectiondrop event arguments. But finally I went with kind of "duplicating" some of the logic happening in rete-connection-plugin inside the capture phase of window's pointerup event, which will hapen before the connectiondrop event fires (both use same window event, but the package not in the capture phase).

Pseudocode solution:

let createNode = false;

editor.on('connectionpick', handlePick);
editor.on('conn…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kh-viewar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant