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
@@ -122,6 +122,7 @@
connectionMode: store.connectionMode, connectionMode: store.connectionMode,
lib: 'svelte', lib: 'svelte',
autoPanOnConnect: store.autoPanOnConnect, autoPanOnConnect: store.autoPanOnConnect,
autoPanSpeed: store.autoPanSpeed,
flowId: store.flowId, flowId: store.flowId,
isValidConnection: isValidConnection ?? store.isValidConnection, isValidConnection: isValidConnection ?? store.isValidConnection,
updateConnection: store.updateConnection, updateConnection: store.updateConnection,
@@ -94,6 +94,8 @@
noPanClass, noPanClass,
noWheelClass, noWheelClass,
ariaLabelConfig, ariaLabelConfig,
autoPanSpeed,
panOnScrollSpeed,
...divAttributes ...divAttributes
} = $derived(rest); } = $derived(rest);
/* eslint-enable @typescript-eslint/no-unused-vars */ /* eslint-enable @typescript-eslint/no-unused-vars */
@@ -239,6 +239,11 @@ export type SvelteFlowProps<
* @default true * @default true
*/ */
nodesDraggable?: boolean; 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. * When `true`, the viewport will pan when a node is focused.
* @default true * @default true
@@ -286,6 +286,7 @@ export function getInitialStore<NodeType extends Node = Node, EdgeType extends E
autoPanOnNodeDrag: boolean = $derived(signals.props.autoPanOnNodeDrag ?? true); autoPanOnNodeDrag: boolean = $derived(signals.props.autoPanOnNodeDrag ?? true);
autoPanOnConnect: boolean = $derived(signals.props.autoPanOnConnect ?? true); autoPanOnConnect: boolean = $derived(signals.props.autoPanOnConnect ?? true);
autoPanOnNodeFocus: boolean = $derived(signals.props.autoPanOnNodeFocus ?? true); autoPanOnNodeFocus: boolean = $derived(signals.props.autoPanOnNodeFocus ?? true);
autoPanSpeed: number = $derived(signals.props.autoPanSpeed ?? 15);
connectionDragThreshold: number = $derived(signals.props.connectionDragThreshold ?? 1); connectionDragThreshold: number = $derived(signals.props.connectionDragThreshold ?? 1);
fitViewQueued: boolean = signals.props.fitView ?? false; fitViewQueued: boolean = signals.props.fitView ?? false;