feat(props): add connectionDragThreshold
This commit is contained in:
@@ -92,6 +92,7 @@ export function EdgeUpdateAnchors<EdgeType extends Edge = Edge>({
|
||||
updateConnection,
|
||||
getTransform: () => store.getState().transform,
|
||||
getFromHandle: () => store.getState().connection.fromHandle,
|
||||
dragThreshold: store.getState().connectionDragThreshold,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -149,6 +149,7 @@ function HandleComponent(
|
||||
getTransform: () => store.getState().transform,
|
||||
getFromHandle: () => store.getState().connection.fromHandle,
|
||||
autoPanSpeed: currentStore.autoPanSpeed,
|
||||
dragThreshold: currentStore.connectionDragThreshold,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ const reactFlowFieldsToTrack = [
|
||||
'isValidConnection',
|
||||
'selectNodesOnDrag',
|
||||
'nodeDragThreshold',
|
||||
'connectionDragThreshold',
|
||||
'onBeforeDelete',
|
||||
'debug',
|
||||
'autoPanSpeed',
|
||||
|
||||
@@ -139,6 +139,7 @@ function ReactFlow<NodeType extends Node = Node, EdgeType extends Edge = Edge>(
|
||||
style,
|
||||
id,
|
||||
nodeDragThreshold,
|
||||
connectionDragThreshold,
|
||||
viewport,
|
||||
onViewportChange,
|
||||
width,
|
||||
@@ -306,6 +307,7 @@ function ReactFlow<NodeType extends Node = Node, EdgeType extends Edge = Edge>(
|
||||
isValidConnection={isValidConnection}
|
||||
selectNodesOnDrag={selectNodesOnDrag}
|
||||
nodeDragThreshold={nodeDragThreshold}
|
||||
connectionDragThreshold={connectionDragThreshold}
|
||||
onBeforeDelete={onBeforeDelete}
|
||||
paneClickDistance={paneClickDistance}
|
||||
debug={debug}
|
||||
|
||||
@@ -107,6 +107,7 @@ const getInitialState = ({
|
||||
noPanClassName: 'nopan',
|
||||
nodeOrigin: storeNodeOrigin,
|
||||
nodeDragThreshold: 1,
|
||||
connectionDragThreshold: 1,
|
||||
|
||||
snapGrid: [15, 15],
|
||||
snapToGrid: false,
|
||||
|
||||
@@ -657,6 +657,12 @@ export interface ReactFlowProps<NodeType extends Node = Node, EdgeType extends E
|
||||
* @default 1
|
||||
*/
|
||||
nodeDragThreshold?: number;
|
||||
/**
|
||||
* The threshold in pixels that the mouse must move before a connection line starts to drag.
|
||||
* This is useful to prevent accidental connections when clicking on a handle.
|
||||
* @default 1
|
||||
*/
|
||||
connectionDragThreshold?: number;
|
||||
/** Sets a fixed width for the flow. */
|
||||
width?: number;
|
||||
/** Sets a fixed height for the flow. */
|
||||
|
||||
@@ -76,6 +76,7 @@ export type ReactFlowStore<NodeType extends Node = Node, EdgeType extends Edge =
|
||||
nodeExtent: CoordinateExtent;
|
||||
nodeOrigin: NodeOrigin;
|
||||
nodeDragThreshold: number;
|
||||
connectionDragThreshold: number;
|
||||
|
||||
nodesSelectionActive: boolean;
|
||||
userSelectionActive: boolean;
|
||||
|
||||
Reference in New Issue
Block a user