fix(subflows): handle selections correctly
This commit is contained in:
@@ -8,11 +8,9 @@ function useVisibleNodes(onlyRenderVisible: boolean) {
|
||||
const nodes = useStore(
|
||||
useCallback(
|
||||
(s: ReactFlowState) => {
|
||||
// @TODO: work with nodeInternals instead of converting it to an array
|
||||
const nodes = Array.from(s.nodeInternals).map(([_, node]) => node);
|
||||
return onlyRenderVisible
|
||||
? getNodesInside(nodes, { x: 0, y: 0, width: s.width, height: s.height }, s.transform, true)
|
||||
: nodes;
|
||||
? getNodesInside(s.nodeInternals, { x: 0, y: 0, width: s.width, height: s.height }, s.transform, true)
|
||||
: Array.from(s.nodeInternals).map(([_, node]) => node);
|
||||
},
|
||||
[onlyRenderVisible]
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ import { zoomIdentity } from 'd3-zoom';
|
||||
import shallow from 'zustand/shallow';
|
||||
|
||||
import { useStoreApi, useStore } from '../store';
|
||||
import { getRectOfNodes, pointToRendererPoint, getTransformForBounds } from '../utils/graph';
|
||||
import { getRectOfNodeInternals, pointToRendererPoint, getTransformForBounds } from '../utils/graph';
|
||||
import { FitViewParams, FlowTransform, ZoomPanHelperFunctions, ReactFlowState, Rect, XYPosition } from '../types';
|
||||
|
||||
const DEFAULT_PADDING = 0.1;
|
||||
@@ -48,7 +48,9 @@ const useZoomPanHelper = (): ZoomPanHelperFunctions => {
|
||||
return;
|
||||
}
|
||||
|
||||
const bounds = getRectOfNodes(options.includeHiddenNodes ? nodes : nodes.filter((node) => !node.hidden));
|
||||
const bounds = getRectOfNodeInternals(
|
||||
options.includeHiddenNodes ? nodes : nodes.filter((node) => !node.hidden)
|
||||
);
|
||||
const [x, y, zoom] = getTransformForBounds(
|
||||
bounds,
|
||||
width,
|
||||
|
||||
Reference in New Issue
Block a user