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

Flowviewer - Auto Frame Content #106

Open
joepavitt opened this issue Sep 21, 2023 · 1 comment
Open

Flowviewer - Auto Frame Content #106

joepavitt opened this issue Sep 21, 2023 · 1 comment

Comments

@joepavitt
Copy link
Contributor

Currently, the flowviewer default zoom level to "1", with a current scale limit at 0.5.

Assuming that scale 0.5 means twice as zoomed out as 1, then if there are nodes out of this view, they cannot be seen. until a user zooms and pans accordingly. A quick solution here would be to measures the maximum x/y coordinates of the nodes, adds a padding factor (e.g. 1.05), and then reassert the zoom level to be:

zoom = fudge_factor * (init_window_size.x / max_node_x)

e.g. if window width is 300, and a node is found at 450, then with a fudge_factor of 1.05 the zoom level would 0.7.

@gorenje
Copy link

gorenje commented Sep 21, 2023

My experience is that there will always be content that won't fit (e.g. content that is thin and long either vertically or horizontally), hence I use the bounding box of the all content (that's why I created the containerGroup) and set the viewBox of the svg to that. That ensures a) the browser does the work and b) it works on mobile and desktop.

Disadvantage is that this happens in the browser and hence the user will notice it - zoom is reset.

EDIT:

additionally some flows have their content far away from (0,0) and then zoom becomes even weirder since you have work on where to center the zoom ...

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

2 participants