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

Workflow diagram zoom #7151

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Workflow diagram zoom #7151

wants to merge 4 commits into from

Conversation

Devessier
Copy link
Contributor

@Devessier Devessier commented Sep 19, 2024

What this PR adds

  • Set a smaller size to the "+" button to create new steps
  • Fit the flow in the view when the flow has been initialized by listening to the onInit event.
  • Reset the Reactflow component instance when the current workflow version changes. This will re-trigger the onInit callback to re-fit the flow in the view.

Comments

We must call fitView in the onInit callback instead of relying on the fitView property of the Reactflow component because we rely on the first render of the nodes to measure their sizes and position the nodes with a layout algorithm, which corrupts the behavior of fitView.
The onInit callback seems to be called after the dimensions of the nodes have been measured and the nodes correctly positioned, which is the perfect timing to adjust the viewport.

Result

New

CleanShot 2024-09-19 at 15 28 00@2x

CleanShot 2024-09-19 at 15 28 03@2x

Old

CleanShot 2024-09-19 at 15 34 52@2x

CleanShot 2024-09-19 at 15 34 46@2x

Closes #7047

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

Successfully merging this pull request may close these issues.

Make the default zoom of the workflow visualizer smaller
1 participant