@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'@xyflow/svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Add missing props autoPanSpeed and panOnScrollSpeed
|
||||||
@@ -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,
|
||||||
|
|||||||
@@ -59,6 +59,7 @@
|
|||||||
zoomOnDoubleClick = true,
|
zoomOnDoubleClick = true,
|
||||||
zoomOnPinch = true,
|
zoomOnPinch = true,
|
||||||
panOnScroll = false,
|
panOnScroll = false,
|
||||||
|
panOnScrollSpeed = 0.5,
|
||||||
panOnDrag = true,
|
panOnDrag = true,
|
||||||
selectionOnDrag = true,
|
selectionOnDrag = true,
|
||||||
connectionLineComponent,
|
connectionLineComponent,
|
||||||
@@ -152,6 +153,7 @@
|
|||||||
{zoomOnDoubleClick}
|
{zoomOnDoubleClick}
|
||||||
{zoomOnPinch}
|
{zoomOnPinch}
|
||||||
{panOnScroll}
|
{panOnScroll}
|
||||||
|
{panOnScrollSpeed}
|
||||||
{panOnDrag}
|
{panOnDrag}
|
||||||
{paneClickDistance}
|
{paneClickDistance}
|
||||||
{onmovestart}
|
{onmovestart}
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -305,6 +310,12 @@ export type SvelteFlowProps<
|
|||||||
* @default false
|
* @default false
|
||||||
*/
|
*/
|
||||||
panOnScroll?: boolean;
|
panOnScroll?: boolean;
|
||||||
|
/**
|
||||||
|
* Controls how fast viewport should be panned on scroll.
|
||||||
|
* Use together with `panOnScroll` prop.
|
||||||
|
* @default 0.5
|
||||||
|
*/
|
||||||
|
panOnScrollSpeed?: number;
|
||||||
/**
|
/**
|
||||||
* This prop is used to limit the direction of panning when panOnScroll is enabled.
|
* This prop is used to limit the direction of panning when panOnScroll is enabled.
|
||||||
* The "free" option allows panning in any direction.
|
* The "free" option allows panning in any direction.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts" generics="NodeType extends Node = Node, EdgeType extends Edge = Edge">
|
<script lang="ts" generics="NodeType extends Node = Node, EdgeType extends Edge = Edge">
|
||||||
import { PanOnScrollMode, type PanZoomInstance, type Transform } from '@xyflow/system';
|
import { type PanZoomInstance, type Transform } from '@xyflow/system';
|
||||||
|
|
||||||
import zoom from '$lib/actions/zoom';
|
import zoom from '$lib/actions/zoom';
|
||||||
import type { ZoomProps } from './types';
|
import type { ZoomProps } from './types';
|
||||||
@@ -7,14 +7,15 @@
|
|||||||
|
|
||||||
let {
|
let {
|
||||||
store = $bindable(),
|
store = $bindable(),
|
||||||
panOnScrollMode = PanOnScrollMode.Free,
|
panOnScrollMode,
|
||||||
preventScrolling = true,
|
preventScrolling,
|
||||||
zoomOnScroll = true,
|
zoomOnScroll,
|
||||||
zoomOnDoubleClick = true,
|
zoomOnDoubleClick,
|
||||||
zoomOnPinch = true,
|
zoomOnPinch,
|
||||||
panOnDrag = true,
|
panOnDrag,
|
||||||
panOnScroll = false,
|
panOnScroll,
|
||||||
paneClickDistance = 1,
|
panOnScrollSpeed,
|
||||||
|
paneClickDistance,
|
||||||
onmovestart,
|
onmovestart,
|
||||||
onmove,
|
onmove,
|
||||||
onmoveend,
|
onmoveend,
|
||||||
@@ -58,8 +59,8 @@
|
|||||||
zoomOnPinch,
|
zoomOnPinch,
|
||||||
panOnScroll: panOnScrollActive,
|
panOnScroll: panOnScrollActive,
|
||||||
panOnDrag: panOnDragActive,
|
panOnDrag: panOnDragActive,
|
||||||
panOnScrollSpeed: 0.5,
|
panOnScrollSpeed,
|
||||||
panOnScrollMode: panOnScrollMode || PanOnScrollMode.Free,
|
panOnScrollMode,
|
||||||
zoomActivationKeyPressed: store.zoomActivationKeyPressed,
|
zoomActivationKeyPressed: store.zoomActivationKeyPressed,
|
||||||
preventScrolling: typeof preventScrolling === 'boolean' ? preventScrolling : true,
|
preventScrolling: typeof preventScrolling === 'boolean' ? preventScrolling : true,
|
||||||
noPanClassName: store.noPanClass,
|
noPanClassName: store.noPanClass,
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import type { Snippet } from 'svelte';
|
|||||||
export type ZoomProps<NodeType extends Node = Node, EdgeType extends Edge = Edge> = {
|
export type ZoomProps<NodeType extends Node = Node, EdgeType extends Edge = Edge> = {
|
||||||
store: SvelteFlowStore<NodeType, EdgeType>;
|
store: SvelteFlowStore<NodeType, EdgeType>;
|
||||||
panOnScrollMode: PanOnScrollMode;
|
panOnScrollMode: PanOnScrollMode;
|
||||||
|
panOnScrollSpeed: number;
|
||||||
preventScrolling: boolean;
|
preventScrolling: boolean;
|
||||||
zoomOnScroll: boolean;
|
zoomOnScroll: boolean;
|
||||||
zoomOnDoubleClick: boolean;
|
zoomOnDoubleClick: boolean;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user