fix(fitview): emtpy graph doesnt crash closes #50

This commit is contained in:
moklick
2019-10-23 16:16:54 +02:00
parent 390c7f49f5
commit cf118f1c8c
+2 -2
View File
@@ -178,10 +178,10 @@ export const getConnectedEdges = (nodes: Node[], edges: Edge[]): Edge[] => {
}); });
}; };
export const fitView = ({ padding }: FitViewParams = { padding: 0 }): void => { export const fitView = ({ padding }: FitViewParams = { padding: 0.1 }): void => {
const { nodes, width, height, d3Selection, d3Zoom } = store.getState(); const { nodes, width, height, d3Selection, d3Zoom } = store.getState();
if (!d3Selection || !d3Zoom) { if (!d3Selection || !d3Zoom || !nodes.length) {
return; return;
} }