fix(onConnectStop): use correct type closes #403
This commit is contained in:
@@ -22,6 +22,7 @@ import {
|
|||||||
ConnectionLineType,
|
ConnectionLineType,
|
||||||
FlowTransform,
|
FlowTransform,
|
||||||
OnConnectStartFunc,
|
OnConnectStartFunc,
|
||||||
|
OnConnectStopFunc,
|
||||||
} from '../../types';
|
} from '../../types';
|
||||||
|
|
||||||
export interface GraphViewProps {
|
export interface GraphViewProps {
|
||||||
@@ -36,7 +37,7 @@ export interface GraphViewProps {
|
|||||||
onNodeDragStop?: (evt: MouseEvent, node: Node) => void;
|
onNodeDragStop?: (evt: MouseEvent, node: Node) => void;
|
||||||
onConnect?: (connection: Connection | Edge) => void;
|
onConnect?: (connection: Connection | Edge) => void;
|
||||||
onConnectStart?: OnConnectStartFunc;
|
onConnectStart?: OnConnectStartFunc;
|
||||||
onConnectStop?: () => void;
|
onConnectStop?: OnConnectStopFunc;
|
||||||
onLoad?: OnLoadFunc;
|
onLoad?: OnLoadFunc;
|
||||||
onMove?: (flowTransform?: FlowTransform) => void;
|
onMove?: (flowTransform?: FlowTransform) => void;
|
||||||
onMoveStart?: (flowTransform?: FlowTransform) => void;
|
onMoveStart?: (flowTransform?: FlowTransform) => void;
|
||||||
@@ -127,14 +128,20 @@ const GraphView = ({
|
|||||||
const fitView = useStoreActions((actions) => actions.fitView);
|
const fitView = useStoreActions((actions) => actions.fitView);
|
||||||
const zoom = useStoreActions((actions) => actions.zoom);
|
const zoom = useStoreActions((actions) => actions.zoom);
|
||||||
|
|
||||||
const onZoomPaneClick = useCallback((evt: React.MouseEvent) => {
|
const onZoomPaneClick = useCallback(
|
||||||
onPaneClick?.(evt);
|
(evt: React.MouseEvent) => {
|
||||||
unsetNodesSelection();
|
onPaneClick?.(evt);
|
||||||
}, [onPaneClick]);
|
unsetNodesSelection();
|
||||||
|
},
|
||||||
|
[onPaneClick]
|
||||||
|
);
|
||||||
|
|
||||||
const onZoomPaneContextMenu = useCallback((evt: React.MouseEvent) => {
|
const onZoomPaneContextMenu = useCallback(
|
||||||
onPaneContextMenu?.(evt);
|
(evt: React.MouseEvent) => {
|
||||||
}, [onPaneContextMenu]);
|
onPaneContextMenu?.(evt);
|
||||||
|
},
|
||||||
|
[onPaneContextMenu]
|
||||||
|
);
|
||||||
|
|
||||||
useResizeHandler(rendererNode);
|
useResizeHandler(rendererNode);
|
||||||
useGlobalKeyHandler({ onElementsRemove, deleteKeyCode });
|
useGlobalKeyHandler({ onElementsRemove, deleteKeyCode });
|
||||||
@@ -243,7 +250,12 @@ const GraphView = ({
|
|||||||
/>
|
/>
|
||||||
<UserSelection selectionKeyPressed={selectionKeyPressed} />
|
<UserSelection selectionKeyPressed={selectionKeyPressed} />
|
||||||
{nodesSelectionActive && <NodesSelection />}
|
{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>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import {
|
|||||||
ConnectionLineType,
|
ConnectionLineType,
|
||||||
FlowTransform,
|
FlowTransform,
|
||||||
OnConnectStartFunc,
|
OnConnectStartFunc,
|
||||||
|
OnConnectStopFunc,
|
||||||
} from '../../types';
|
} from '../../types';
|
||||||
|
|
||||||
import '../../style.css';
|
import '../../style.css';
|
||||||
@@ -44,7 +45,7 @@ export interface ReactFlowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'on
|
|||||||
onNodeDragStop?: (evt: MouseEvent, node: Node) => void;
|
onNodeDragStop?: (evt: MouseEvent, node: Node) => void;
|
||||||
onConnect?: (connection: Edge | Connection) => void;
|
onConnect?: (connection: Edge | Connection) => void;
|
||||||
onConnectStart?: OnConnectStartFunc;
|
onConnectStart?: OnConnectStartFunc;
|
||||||
onConnectStop?: () => void;
|
onConnectStop?: OnConnectStopFunc;
|
||||||
onLoad?: OnLoadFunc;
|
onLoad?: OnLoadFunc;
|
||||||
onMove?: (flowTransform?: FlowTransform) => void;
|
onMove?: (flowTransform?: FlowTransform) => void;
|
||||||
onMoveStart?: (flowTransform?: FlowTransform) => void;
|
onMoveStart?: (flowTransform?: FlowTransform) => void;
|
||||||
|
|||||||
Reference in New Issue
Block a user