jerosoler / Drawflow

Simple flow library 🖥️🖱️
https://jerosoler.github.io/Drawflow/
MIT License
4.61k stars 721 forks source link

Lag in editor object? #151

Closed techies-sudo closed 3 years ago

techies-sudo commented 3 years ago

Say a node has 3 outnodes, if all three nodes are connected to separate nodes Screenshot from 2021-04-03 16-35-58

if I am removing one node say first one(class which is in right side of the node) , 3 will be removed instead 1 by the library. console.log(editor.drawflow.drawflow.Home.data,state.editor.getNodeFromId(id)) Screenshot from 2021-04-03 17-03-58 though both are same object, outputs object varies , why is this?

jerosoler commented 3 years ago

Hello,

Who wants to delete the connection? or the Output?

Have you tried events? https://github.com/jerosoler/Drawflow#events

Jero

techies-sudo commented 3 years ago

So there is a situation that I want to delete an output class, here I deleted class 1 , I used editor,removeNodeOutput(id, output_class), which deletes class, so connection removal event triggered, then I console both editor and getNodeFromId(id). as I shown above, outputs object differs even though it's the same node . output_1 in right side shows empty object which makes sense since there is nothing connected to it. but it I deleted the object, later I figured that connections to output_2 shifted to output_1 and output_3 to output_2 as shown in left side picture. Why is it?

jerosoler commented 3 years ago

When does the getNodeFromId do? Can you show your code?

Simply because it only has two outputs.

techies-sudo commented 3 years ago

am closing this issue. since I changed the code base I can't share it ,made a work around to make code work.anyway thanks @jerosoler