From 49ddb8040d850722669387feadd842225251ea69 Mon Sep 17 00:00:00 2001 From: moklick Date: Wed, 5 Aug 2020 19:03:06 +0200 Subject: [PATCH] fix(onConnectStop): use correct type closes #403 --- src/container/GraphView/index.tsx | 30 +++++++++++++++++++++--------- src/container/ReactFlow/index.tsx | 3 ++- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/container/GraphView/index.tsx b/src/container/GraphView/index.tsx index 48bbe61a..89ccf623 100644 --- a/src/container/GraphView/index.tsx +++ b/src/container/GraphView/index.tsx @@ -22,6 +22,7 @@ import { ConnectionLineType, FlowTransform, OnConnectStartFunc, + OnConnectStopFunc, } from '../../types'; export interface GraphViewProps { @@ -36,7 +37,7 @@ export interface GraphViewProps { onNodeDragStop?: (evt: MouseEvent, node: Node) => void; onConnect?: (connection: Connection | Edge) => void; onConnectStart?: OnConnectStartFunc; - onConnectStop?: () => void; + onConnectStop?: OnConnectStopFunc; onLoad?: OnLoadFunc; onMove?: (flowTransform?: FlowTransform) => void; onMoveStart?: (flowTransform?: FlowTransform) => void; @@ -127,14 +128,20 @@ const GraphView = ({ const fitView = useStoreActions((actions) => actions.fitView); const zoom = useStoreActions((actions) => actions.zoom); - const onZoomPaneClick = useCallback((evt: React.MouseEvent) => { - onPaneClick?.(evt); - unsetNodesSelection(); - }, [onPaneClick]); + const onZoomPaneClick = useCallback( + (evt: React.MouseEvent) => { + onPaneClick?.(evt); + unsetNodesSelection(); + }, + [onPaneClick] + ); - const onZoomPaneContextMenu = useCallback((evt: React.MouseEvent) => { - onPaneContextMenu?.(evt); - }, [onPaneContextMenu]); + const onZoomPaneContextMenu = useCallback( + (evt: React.MouseEvent) => { + onPaneContextMenu?.(evt); + }, + [onPaneContextMenu] + ); useResizeHandler(rendererNode); useGlobalKeyHandler({ onElementsRemove, deleteKeyCode }); @@ -243,7 +250,12 @@ const GraphView = ({ /> {nodesSelectionActive && } -
+
); }; diff --git a/src/container/ReactFlow/index.tsx b/src/container/ReactFlow/index.tsx index 8b59f307..c74871d3 100644 --- a/src/container/ReactFlow/index.tsx +++ b/src/container/ReactFlow/index.tsx @@ -28,6 +28,7 @@ import { ConnectionLineType, FlowTransform, OnConnectStartFunc, + OnConnectStopFunc, } from '../../types'; import '../../style.css'; @@ -44,7 +45,7 @@ export interface ReactFlowProps extends Omit, 'on onNodeDragStop?: (evt: MouseEvent, node: Node) => void; onConnect?: (connection: Edge | Connection) => void; onConnectStart?: OnConnectStartFunc; - onConnectStop?: () => void; + onConnectStop?: OnConnectStopFunc; onLoad?: OnLoadFunc; onMove?: (flowTransform?: FlowTransform) => void; onMoveStart?: (flowTransform?: FlowTransform) => void;