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

Fit view to all nodes / Calculate panning to align with (X, Y) #197

Closed
TigerHix opened this issue May 15, 2022 · 1 comment · Fixed by #432
Closed

Fit view to all nodes / Calculate panning to align with (X, Y) #197

TigerHix opened this issue May 15, 2022 · 1 comment · Fixed by #432

Comments

@TigerHix
Copy link

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!

@newcat
Copy link
Owner

newcat commented May 16, 2022

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

@newcat newcat added this to V2 Apr 9, 2024
@newcat newcat moved this to To do in V2 Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To do
Development

Successfully merging a pull request may close this issue.

2 participants