Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have added three new commands:
The "zoom to fit graph" command can be activated from a new toolbar button and with the
f
hotkey.There are also some new settings that control how much padding to use when fitting the rect/nodes/graph.
The commands do not take
palette.enabled
andtoolbar.enabled
into account. That is why the left padding and the top padding are larger - they account for the width of the palette and the height of the toolbar.I did consider making the commands check if the palette and the toolbar are enabled, and automatically adding extra padding if necessary. However, because the components and styles for the palette and toolbar can easily be changed, I didn't think we could assume their positions or sizes.
It means that if the palette or the toolbar is disabled, then the padding settings will also need to be adjusted to ensure the nodes are still positioned in the center of the editor. Likewise, if the palette or the toolbar is repositioned or resized, the padding settings will need to be adjusted.
It's not ideal that disabling the palette or the toolbar also requires the padding settings to be adjusted. But I think overall this solution is the simplest and most flexible. What do you think?