feat(svelte): ssr fitView

This commit is contained in:
moklick
2023-10-23 18:05:45 +02:00
parent 9351a492ac
commit 2435a0da8f
6 changed files with 39 additions and 12 deletions
+8 -4
View File
@@ -33,14 +33,16 @@ export function createStore({
nodes,
edges,
width,
height
height,
fitView: fitViewOnCreate
}: {
nodes?: Node[];
edges?: Edge[];
width?: number;
height?: number;
fitView?: boolean;
}): SvelteFlowStore {
const store = getInitialStore({ nodes, edges, width, height });
const store = getInitialStore({ nodes, edges, width, height, fitView: fitViewOnCreate });
function setNodeTypes(nodeTypes: NodeTypes) {
store.nodeTypes.set({
@@ -347,14 +349,16 @@ export function createStoreContext({
nodes,
edges,
width,
height
height,
fitView
}: {
nodes?: Node[];
edges?: Edge[];
width?: number;
height?: number;
fitView?: boolean;
}) {
const store = createStore({ nodes, edges, width, height });
const store = createStore({ nodes, edges, width, height, fitView });
setContext(key, {
getStore: () => store