jerosoler / Drawflow

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

Saving the position of the NODES after dragging #881

Open pninarubin opened 1 week ago

pninarubin commented 1 week ago

Hi, I have nodes, and when I drag them to another location on the canvas After saving, they are not saved in the new location but remain as they were. If you have a solution for me, I have tried numerous things with no success. I'd be happy .

jerosoler commented 1 week ago

Where do you save the nodes, how do you load them again?

Do you use the export/import method?

pninarubin commented 5 days ago

in the drag function In the end I give this line: this.process.json = JSON.stringify(this.editor.export()); And in the save function all the this.process has been sent to save. He works after he guards me, he doesn't guard and the dead stay in the same place. I tried to create a special listener for the drag using the 'nodeMoved' function that exists in your fria, but it didn't listen to it. This is a problem for me and I would love to hear a solution.

This is the function I built and it doesn't work: this.editor.on('nodeMoved', (id) => { console.log(id); this.movedNode(id); });