diff --git a/frontend/src/lib/components/Node.svelte b/frontend/src/lib/components/Node.svelte index 40d63ce..134d52a 100644 --- a/frontend/src/lib/components/Node.svelte +++ b/frontend/src/lib/components/Node.svelte @@ -4,7 +4,6 @@ import NodeHeader from "./NodeHeader.svelte"; import NodeParameter from "./NodeParameter.svelte"; import { activeNodeId, selectedNodes } from "./graph/stores"; - import { getGraphManager } from "./graph/context"; export let node: Node; export let inView = true; @@ -18,7 +17,10 @@ let ref: HTMLDivElement; - $: if (node) { + $: if (node && ref) { + node.tmp = node.tmp || {}; + node.tmp.ref = ref; + updateNodePosition(node); } onMount(() => { diff --git a/frontend/src/lib/graph-manager.ts b/frontend/src/lib/graph-manager.ts index 4d34ea3..f2a1d10 100644 --- a/frontend/src/lib/graph-manager.ts +++ b/frontend/src/lib/graph-manager.ts @@ -103,7 +103,7 @@ export class GraphManager { setTimeout(() => { this.status.set("idle"); - this.history.save(); + this.save(); }, 100) } @@ -155,7 +155,7 @@ export class GraphManager { nodes.delete(node.id); return nodes; }); - this.history.save(); + this.save(); } createEdge(from: Node, fromSocket: number, to: Node, toSocket: string) { @@ -183,6 +183,10 @@ export class GraphManager { return [...edges.filter(e => e[2].id !== to.id || e[3] !== toSocket), [from, fromSocket, to, toSocket]]; }); + this.save(); + } + + save() { this.history.save(); } @@ -260,7 +264,7 @@ export class GraphManager { this.edges.update((edges) => { return edges.filter((e) => e[0].id !== id0 || e[1] !== sid0 || e[2].id !== id2 || e[3] !== sid2); }); - this.history.save(); + this.save(); } getEdgesToNode(node: Node) { diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte index 12dbabb..2ebb019 100644 --- a/frontend/src/routes/+page.svelte +++ b/frontend/src/routes/+page.svelte @@ -2,8 +2,6 @@ import { Canvas } from "@threlte/core"; import { GraphManager } from "$lib/graph-manager"; import Graph from "$lib/components/graph/Graph.svelte"; - import Details from "$lib/elements/Details.svelte"; - import { JsonView } from "@zerodevx/svelte-json-view"; import { MemoryRuntimeExecutor } from "$lib/runtime-executor"; import { MemoryNodeRegistry } from "$lib/node-registry";