refactor(fitView): use same fitView function for viewport helper and initial prop
This commit is contained in:
@@ -25,7 +25,7 @@ const Controls: FC<ControlProps> = ({
|
||||
showZoom = true,
|
||||
showFitView = true,
|
||||
showInteractive = true,
|
||||
fitViewParams,
|
||||
fitViewOptions,
|
||||
onZoomIn,
|
||||
onZoomOut,
|
||||
onFitView,
|
||||
@@ -51,9 +51,9 @@ const Controls: FC<ControlProps> = ({
|
||||
}, [zoomOut, onZoomOut]);
|
||||
|
||||
const onFitViewHandler = useCallback(() => {
|
||||
fitView?.(fitViewParams);
|
||||
fitView?.(fitViewOptions);
|
||||
onFitView?.();
|
||||
}, [fitView, fitViewParams, onFitView]);
|
||||
}, [fitView, fitViewOptions, onFitView]);
|
||||
|
||||
const onInteractiveChangeHandler = useCallback(() => {
|
||||
store.setState({
|
||||
|
||||
@@ -5,7 +5,7 @@ import shallow from 'zustand/shallow';
|
||||
import MiniMapNode from './MiniMapNode';
|
||||
|
||||
import { useStore } from '../../store';
|
||||
import { getRectOfNodeInternals } from '../../utils/graph';
|
||||
import { getRectOfNodes } from '../../utils/graph';
|
||||
import { getBoundsofRects } from '../../utils';
|
||||
|
||||
import { MiniMapProps, GetMiniMapNodeAttribute, ReactFlowState, Rect } from '../../types';
|
||||
@@ -48,7 +48,7 @@ const MiniMap = ({
|
||||
const hasNodes = nodeInternals && nodeInternals.size > 0;
|
||||
// @TODO: work with nodeInternals instead of converting it to an array
|
||||
const nodes = Array.from(nodeInternals).map(([_, node]) => node);
|
||||
const bb = getRectOfNodeInternals(nodes);
|
||||
const bb = getRectOfNodes(nodes);
|
||||
const viewBB: Rect = {
|
||||
x: -tX / tScale,
|
||||
y: -tY / tScale,
|
||||
|
||||
Reference in New Issue
Block a user