Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node and editor position not included in state object #261

Closed
MioAtSwivel opened this issue Feb 13, 2023 · 4 comments
Closed

Node and editor position not included in state object #261

MioAtSwivel opened this issue Feb 13, 2023 · 4 comments

Comments

@MioAtSwivel
Copy link
Contributor

From the API documentation, the save() function returns a IEditorState containing IGraphState for root graph and IGraphTemplateState[] for subgraphs.
However *none of the objects persist the position of each nodes, and also the field of view of the editor, making the graph looks like a compressed spaghetti when loaded back from database for editing.

Below is a short GIF to demonstrate the problem. Observe the IEditorState being printed, every time it is the same object even after some relocation and zooming.
brave_vaZyX7MSji

@newcat
Copy link
Owner

newcat commented Feb 20, 2023

The panning and scaling of the view weren't saved, that is correct. That will be fixed in the next release. However, the position of the nodes is saved and in my playground, it works. How do you initialize the useBaklavaView? Because it adds these properties to the saved state (code).

@MioAtSwivel
Copy link
Contributor Author

The baklava instance is initialized the method described in the documentation, using the useBaklava() function, and then pass the object into the editor component like <EditorComponent :view-model="baklava"></EditorComponent> https://v2.baklava.tech/getting-started.html#installation

Is the function correct? or there is other correct way to do it

@galipmedia
Copy link

Can you please explain how to include the positioning in the graph / how to include useBaklavaView and use it?

I have an example here https://codesandbox.io/s/baklava-v2-test-forked-sqhsz5?file=/src/App.vue

At the bottom of the page is a save button that console.logs the graph. But there is no mention of positioning. So when I reload it as hardcoded in the example its all in the top left.

I also kind of expected the output of the first node to be the 2 numbers added together?

@newcat
Copy link
Owner

newcat commented Jul 8, 2023

@galipmedia please update to the latest version (2.0.2-beta.4), I just tested it and it seems to work. In case the version isn't available in the CodeSandbox version dropdown, just set the version inside the package.json manually. Check out this example: https://codesandbox.io/s/baklava-v2-saving-loading-w4vnyk?file=/src/App.vue

I also kind of expected the output of the first node to be the 2 numbers added together?

For that you need to set up the engine.

@newcat newcat closed this as completed Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants