fix(svelte): handle nodeOrigin prop

This commit is contained in:
moklick
2024-06-27 16:58:48 +02:00
parent 609f7ed792
commit 7375e81a49
8 changed files with 53 additions and 23 deletions
+5 -2
View File
@@ -14,7 +14,8 @@ import {
type ConnectionLookup,
type EdgeLookup,
type NodeLookup,
type ParentLookup
type ParentLookup,
type NodeOrigin
} from '@xyflow/system';
import type { DefaultEdgeOptions, DefaultNodeOptions, Edge, InternalNode, Node } from '$lib/types';
@@ -129,7 +130,8 @@ export type NodeStoreOptions = {
export const createNodesStore = (
nodes: Node[],
nodeLookup: NodeLookup<InternalNode>,
parentLookup: ParentLookup<InternalNode>
parentLookup: ParentLookup<InternalNode>,
nodeOrigin: NodeOrigin = [0, 0]
): {
subscribe: (this: void, run: Subscriber<Node[]>) => Unsubscriber;
update: (this: void, updater: Updater<Node[]>) => void;
@@ -145,6 +147,7 @@ export const createNodesStore = (
const _set = (nds: Node[]): Node[] => {
adoptUserNodes(nds, nodeLookup, parentLookup, {
elevateNodesOnSelect,
nodeOrigin,
defaults,
checkEquality: false
});