Correct way to save and persist a graph including scale/transform #262
-
|
Hi I would appreciate a bit of help/guidance with the correct way of saving and reloading a graph especially with respect to its scale and transform. If there is an example, please point me to it. I currently have a graph that has a view model containing the nodes and connections The component has: The graph's state is obtained and persisted via: On restore:
But the scale and position of the Any help is appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
|
Hi! Thanks for bringing this up. You can find a complete, working project based on Foblex Flow here: It demonstrates a full real-world setup and covers the same pain points you described (with practical solutions already implemented in the project). Hope this helps - and if you like what we’re building, please consider giving us a ⭐ on GitHub. It really supports the project! |
Beta Was this translation helpful? Give feedback.
Thanks for the detailed report.
This behavior is intentional in our example. After import (and after any “restore/load” scenario) we reset the view so the editor starts from a predictable state: the flow is centered and the canvas scale is reset. That’s why we explicitly call:
So if your goal is to preserve and restore the exact scale / position from the exported transform, you simply should not call resetScaleAndCenter(...) (and rely on your databinding via [scale] / [position] instead).
About fLoaded
fLoaded is emitted when the flow is initialized. It also gets emitted again after a re-init cycle, but…