refactor(elements): split edges and nodes
This commit is contained in:
@@ -3,7 +3,7 @@ import { zoomIdentity } from 'd3-zoom';
|
||||
|
||||
import { useStoreState, useStore } from '../store/hooks';
|
||||
import { clamp } from '../utils';
|
||||
import { getRectOfNodes, isNode } from '../utils/graph';
|
||||
import { getRectOfNodes } from '../utils/graph';
|
||||
import { FitViewParams, FlowTransform, ZoomPanHelperFunctions, Rect, Transform } from '../types';
|
||||
|
||||
const DEFAULT_PADDING = 0.1;
|
||||
@@ -56,8 +56,7 @@ const useZoomPanHelper = (): ZoomPanHelperFunctions => {
|
||||
d3Zoom.transform(d3Selection, nextTransform);
|
||||
},
|
||||
fitView: (options: FitViewParams = { padding: DEFAULT_PADDING, includeHiddenNodes: false }) => {
|
||||
const { elements, width, height, minZoom, maxZoom } = store.getState();
|
||||
const nodes = elements.filter(isNode);
|
||||
const { nodes, width, height, minZoom, maxZoom } = store.getState();
|
||||
|
||||
if (!nodes.length) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user