Fit view to all nodes / Calculate panning to align with (X, Y)
Hi there,
First of all, great library! This helps tremendously with my project and I would love to sponsor / contribute back sometime.
Have you planned to implement a "fit view to all nodes" function (button) in v2? The function should adjust the panning and scaling such that it shows all nodes in the editor viewport.
I am currently trying to implement this myself, but I don't even have idea how to calculate the panning (given scaling) such that a node (or a coordinate in the node's coordinate system) shows at the center of the viewport.
Any help would be appreciated!
I haven't planned it for the initial release for v2, but it certainly is a nice feature so I'll add it to the roadmap.
There is some transformation logic already implemented in the Minimap component, which could help you: https://github.com/newcat/baklavajs/blob/master/packages/baklavajs-plugin-renderer-vue/src/components/Minimap.vue