fix(onConnectStop): use correct type closes #403

This commit is contained in:
moklick
2020-08-05 19:03:06 +02:00
parent 8544f9802f
commit 49ddb8040d
2 changed files with 23 additions and 10 deletions
+21 -9
View File
@@ -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 = ({
/>
<UserSelection selectionKeyPressed={selectionKeyPressed} />
{nodesSelectionActive && <NodesSelection />}
<div className="react-flow__zoompane" onClick={onZoomPaneClick} onContextMenu={onZoomPaneContextMenu} ref={zoomPane} />
<div
className="react-flow__zoompane"
onClick={onZoomPaneClick}
onContextMenu={onZoomPaneContextMenu}
ref={zoomPane}
/>
</div>
);
};
+2 -1
View File
@@ -28,6 +28,7 @@ import {
ConnectionLineType,
FlowTransform,
OnConnectStartFunc,
OnConnectStopFunc,
} from '../../types';
import '../../style.css';
@@ -44,7 +45,7 @@ export interface ReactFlowProps extends Omit<HTMLAttributes<HTMLDivElement>, '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;