variable autoPanSpeed

This commit is contained in:
peterkogo
2024-07-04 16:33:45 +02:00
parent 0589b89d0e
commit 3f259e9662
10 changed files with 37 additions and 10 deletions
@@ -139,6 +139,7 @@ function HandleComponent(
isValidConnection: isValidConnection || currentStore.isValidConnection,
getTransform: () => store.getState().transform,
getFromHandle: () => store.getState().connection.fromHandle,
autoPanSpeed: currentStore.autoPanSpeed,
});
}
@@ -66,6 +66,7 @@ const reactFlowFieldsToTrack = [
'nodeDragThreshold',
'onBeforeDelete',
'debug',
'autoPanSpeed',
] as const;
type ReactFlowFieldsToTrack = (typeof reactFlowFieldsToTrack)[number];
@@ -129,6 +129,7 @@ function ReactFlow<NodeType extends Node = Node, EdgeType extends Edge = Edge>(
disableKeyboardA11y = false,
autoPanOnConnect,
autoPanOnNodeDrag,
autoPanSpeed,
connectionRadius,
isValidConnection,
onError,
@@ -269,6 +270,7 @@ function ReactFlow<NodeType extends Node = Node, EdgeType extends Edge = Edge>(
rfId={rfId}
autoPanOnConnect={autoPanOnConnect}
autoPanOnNodeDrag={autoPanOnNodeDrag}
autoPanSpeed={autoPanSpeed}
onError={onError}
connectionRadius={connectionRadius}
isValidConnection={isValidConnection}
+1
View File
@@ -112,6 +112,7 @@ const getInitialState = ({
ariaLiveMessage: '',
autoPanOnConnect: true,
autoPanOnNodeDrag: true,
autoPanSpeed: 15,
connectionRadius: 20,
onError: devWarn,
isValidConnection: undefined,
@@ -471,6 +471,10 @@ export interface ReactFlowProps<NodeType extends Node = Node, EdgeType extends E
* @default true
*/
autoPanOnConnect?: boolean;
/** The speed at which the viewport pans while dragging a node or a selection box.
* @default 15
*/
autoPanSpeed?: number;
/** You can enable this prop to automatically pan the viewport while making a new connection.
* @default true
*/
+1
View File
@@ -139,6 +139,7 @@ export type ReactFlowStore<NodeType extends Node = Node, EdgeType extends Edge =
ariaLiveMessage: string;
autoPanOnConnect: boolean;
autoPanOnNodeDrag: boolean;
autoPanSpeed: number;
connectionRadius: number;
isValidConnection?: IsValidConnection<EdgeType>;