Skip to content

Commit

Permalink
fitView to dimensions now checks if it got nodes as argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Paweł Jaśpiński committed Sep 14, 2021
1 parent e21e1bc commit 0039fc0
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 15 deletions.
7 changes: 5 additions & 2 deletions dist/ReactFlow.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/ReactFlow.esm.js.map

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions dist/ReactFlow.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/ReactFlow.js.map

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions dist/nocss/ReactFlow-nocss.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/nocss/ReactFlow-nocss.esm.js.map

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions dist/nocss/ReactFlow-nocss.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/nocss/ReactFlow-nocss.js.map

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/hooks/useZoomPanHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ const useZoomPanHelper = (): ZoomPanHelperFunctions => {

d3Zoom.transform(d3Selection, transform);
},
fitViewToDimensions: (options: FitViewToDimensionsParams = { height: 0, width: 0, nodes: store.getState().nodes, padding: DEFAULT_PADDING, includeHiddenNodes: false }) => {
const { minZoom, maxZoom } = store.getState();
fitViewToDimensions: (options: FitViewToDimensionsParams = { height: 0, width: 0, nodes: [], padding: DEFAULT_PADDING, includeHiddenNodes: false }) => {
let { nodes, minZoom, maxZoom } = store.getState();

if (!options.nodes.length) {
if(options.nodes) nodes = options.nodes

if (!nodes.length) {
return;
}

Expand Down

0 comments on commit 0039fc0

Please sign in to comment.