jerosoler / Drawflow

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

drawflow nodes pos_x and pox_y issue #882

Closed heziosight closed 2 months ago

heziosight commented 2 months ago

Hello,
when i switch between components or save my drawflow , nodes positions are reset to default and lost they x , y positions. i found the issue happen just after json is import if (json1.drawflow) { this.editor.import(json1); this.isStartNodeAdded = Object.values(json1.drawflow.Home.data).some((node: any) => node.name === 'start');

i attached sample video
chrome-capture-2024-6-17

how i can solve it? thanks

jerosoler commented 2 months ago

Try settimeout on import method.

heziosight commented 2 months ago

I tried but it didn't fix the problem :(

heziosight commented 2 months ago

@jerosoler issue has been solved by set saveDrawflowState() { if (this.editor) { this.process.json = JSON.stringify(this.editor.export()); } method in drawflow component and called it by (click)="workflowComponent?.saveDrawflowState(); of selected tab , ensuring the current state of the drawflow is saved

thanks anyway!