chore(useReactFlow): cleanup
This commit is contained in:
@@ -47,10 +47,7 @@ export function useReactFlow<NodeType extends Node = Node, EdgeType extends Edge
|
|||||||
return edges.map((e) => ({ ...e })) as EdgeType[];
|
return edges.map((e) => ({ ...e })) as EdgeType[];
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const getEdge = useCallback<Instance.GetEdge<EdgeType>>((id) => {
|
const getEdge = useCallback<Instance.GetEdge<EdgeType>>((id) => store.getState().edgeLookup.get(id) as EdgeType, []);
|
||||||
const { edges = [] } = store.getState();
|
|
||||||
return edges.find((e) => e.id === id) as EdgeType;
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
type SetElementsQueue = {
|
type SetElementsQueue = {
|
||||||
nodes: (NodeType[] | ((nodes: NodeType[]) => NodeType[]))[];
|
nodes: (NodeType[] | ((nodes: NodeType[]) => NodeType[]))[];
|
||||||
|
|||||||
@@ -183,8 +183,9 @@ export function handleExpandParent(
|
|||||||
const dimensions = getNodeDimensions(parent);
|
const dimensions = getNodeDimensions(parent);
|
||||||
|
|
||||||
// determine how much the parent expands by moving the position
|
// determine how much the parent expands by moving the position
|
||||||
let xChange = expandedRect.x < position.x ? Math.round(Math.abs(position.x - expandedRect.x)) : 0;
|
const xChange = expandedRect.x < position.x ? Math.round(Math.abs(position.x - expandedRect.x)) : 0;
|
||||||
let yChange = expandedRect.y < position.y ? Math.round(Math.abs(position.y - expandedRect.y)) : 0;
|
const yChange = expandedRect.y < position.y ? Math.round(Math.abs(position.y - expandedRect.y)) : 0;
|
||||||
|
|
||||||
if (xChange > 0 || yChange > 0) {
|
if (xChange > 0 || yChange > 0) {
|
||||||
changes.push({
|
changes.push({
|
||||||
id: parentId,
|
id: parentId,
|
||||||
|
|||||||
Reference in New Issue
Block a user