feat(svelte) added connectionMode prop
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
Controls,
|
||||
Background,
|
||||
MiniMap,
|
||||
ConnectionMode,
|
||||
} from '@xyflow/react';
|
||||
|
||||
const onNodeDragStart = (_: ReactMouseEvent, node: Node, nodes: Node[]) => console.log('drag start', node, nodes);
|
||||
@@ -193,6 +194,7 @@ const OverviewFlow = () => {
|
||||
<ReactFlow
|
||||
nodes={nodes}
|
||||
edges={edges}
|
||||
connectionMode={ConnectionMode.Loose}
|
||||
onNodesChange={onNodesChange}
|
||||
onEdgesChange={onEdgesChange}
|
||||
onNodeClick={onNodeClick}
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
type NodeTypes,
|
||||
type EdgeTypes,
|
||||
type Node,
|
||||
type Edge
|
||||
type Edge,
|
||||
ConnectionMode
|
||||
} from '@xyflow/svelte';
|
||||
|
||||
import CustomNode from './CustomNode.svelte';
|
||||
@@ -161,6 +162,7 @@
|
||||
}}
|
||||
autoPanOnConnect
|
||||
autoPanOnNodeDrag
|
||||
connectionMode={ConnectionMode.Loose}
|
||||
>
|
||||
<Controls />
|
||||
<Background variant={BackgroundVariant.Dots} />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { onMount, hasContext } from 'svelte';
|
||||
import cc from 'classcat';
|
||||
import { PanOnScrollMode, type Viewport } from '@xyflow/system';
|
||||
import { ConnectionMode, PanOnScrollMode, type Viewport } from '@xyflow/system';
|
||||
|
||||
import { Zoom } from '$lib/container/Zoom';
|
||||
import { Pane } from '$lib/container/Pane';
|
||||
@@ -38,6 +38,7 @@
|
||||
export let deleteKey: $$Props['deleteKey'] = undefined;
|
||||
export let connectionRadius: $$Props['connectionRadius'] = undefined;
|
||||
export let connectionLineType: $$Props['connectionLineType'] = undefined;
|
||||
export let connectionMode: $$Props['connectionMode'] = ConnectionMode.Strict;
|
||||
export let onMoveStart: $$Props['onMoveStart'] = undefined;
|
||||
export let onMove: $$Props['onMove'] = undefined;
|
||||
export let onMoveEnd: $$Props['onMoveEnd'] = undefined;
|
||||
@@ -108,7 +109,8 @@
|
||||
isValidConnection,
|
||||
autoPanOnConnect,
|
||||
autoPanOnNodeDrag,
|
||||
onError
|
||||
onError,
|
||||
connectionMode
|
||||
};
|
||||
|
||||
updateStoreByKeys(store, updatableProps);
|
||||
|
||||
@@ -14,7 +14,8 @@ import type {
|
||||
IsValidConnection,
|
||||
HandleType,
|
||||
NodeBase,
|
||||
OnError
|
||||
OnError,
|
||||
ConnectionMode
|
||||
} from '@xyflow/system';
|
||||
|
||||
import type { Edge, Node, NodeTypes, KeyDefinition, EdgeTypes } from '$lib/types';
|
||||
@@ -35,6 +36,7 @@ export type SvelteFlowProps = DOMAttributes<HTMLDivElement> & {
|
||||
maxZoom?: number;
|
||||
initialViewport?: Viewport;
|
||||
connectionRadius?: number;
|
||||
connectionMode?: ConnectionMode;
|
||||
selectionMode?: SelectionMode;
|
||||
snapGrid?: SnapGrid;
|
||||
defaultMarkerColor?: string;
|
||||
|
||||
@@ -61,6 +61,7 @@ export type UpdatableStoreProps = {
|
||||
isValidConnection?: UnwrapWritable<SvelteFlowStore['isValidConnection']>;
|
||||
autoPanOnConnect?: UnwrapWritable<SvelteFlowStore['autoPanOnConnect']>;
|
||||
autoPanOnNodeDrag?: UnwrapWritable<SvelteFlowStore['autoPanOnNodeDrag']>;
|
||||
connectionMode?: UnwrapWritable<SvelteFlowStore['connectionMode']>;
|
||||
onError?: UnwrapWritable<SvelteFlowStore['onError']>;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user