add autoPanSpeed

This commit is contained in:
peterkogo
2025-09-15 16:35:19 +02:00
parent 34929087e1
commit f0eab72ee5
4 changed files with 9 additions and 0 deletions

View File

@@ -122,6 +122,7 @@
connectionMode: store.connectionMode,
lib: 'svelte',
autoPanOnConnect: store.autoPanOnConnect,
autoPanSpeed: store.autoPanSpeed,
flowId: store.flowId,
isValidConnection: isValidConnection ?? store.isValidConnection,
updateConnection: store.updateConnection,

View File

@@ -94,6 +94,8 @@
noPanClass,
noWheelClass,
ariaLabelConfig,
autoPanSpeed,
panOnScrollSpeed,
...divAttributes
} = $derived(rest);
/* eslint-enable @typescript-eslint/no-unused-vars */

View File

@@ -239,6 +239,11 @@ export type SvelteFlowProps<
* @default true
*/
nodesDraggable?: boolean;
/**
* The speed at which the viewport pans while dragging a node or a selection box.
* @default 15
*/
autoPanSpeed?: number;
/**
* When `true`, the viewport will pan when a node is focused.
* @default true

View File

@@ -286,6 +286,7 @@ export function getInitialStore<NodeType extends Node = Node, EdgeType extends E
autoPanOnNodeDrag: boolean = $derived(signals.props.autoPanOnNodeDrag ?? true);
autoPanOnConnect: boolean = $derived(signals.props.autoPanOnConnect ?? true);
autoPanOnNodeFocus: boolean = $derived(signals.props.autoPanOnNodeFocus ?? true);
autoPanSpeed: number = $derived(signals.props.autoPanSpeed ?? 15);
connectionDragThreshold: number = $derived(signals.props.connectionDragThreshold ?? 1);
fitViewQueued: boolean = signals.props.fitView ?? false;