Access handle of custom node #1491
-
I noticed that every vueflow handle in a custom component should be given a type which is either "source" or "target". My goal is to only allow connections from a handle of type="source" to type="target" (but not from type="source" to type="source" or from type="target" to type="target"). The following code fails to achieve this goal, because my custom node does not have any information about my handle.
I have already seen people define handles in their initialNodes object like this:
or this
But since I already have defined the handles in my custom components templates, adding this to my initialNodes object would give me two definitions of the props id, type and position. This is awful programming. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You only need to use everything else is unnecessary to restrict the connections from source <--> source (and target <--> target) |
Beta Was this translation helpful? Give feedback.
Well, I guess since you've seemingly never touched TypeScript enums aren't a familiar concept (yet?) ^^
You import this, same as
Position
for<Handle>
, from@vue-flow/core
.What exactly are you looking for?
"Handles" aren't stored anywhere, VueFlow stores handle bounds which isn't the same thing.
What are you trying to achieve?
Describe the problem you are trying to s…