feat: store camera position in localStorage
This commit is contained in:
parent
d1d9d7ecae
commit
3811a6bdb4
@ -4,7 +4,6 @@
|
|||||||
import NodeHeader from "./NodeHeader.svelte";
|
import NodeHeader from "./NodeHeader.svelte";
|
||||||
import NodeParameter from "./NodeParameter.svelte";
|
import NodeParameter from "./NodeParameter.svelte";
|
||||||
import { activeNodeId, selectedNodes } from "./graph/stores";
|
import { activeNodeId, selectedNodes } from "./graph/stores";
|
||||||
import { getGraphManager } from "./graph/context";
|
|
||||||
|
|
||||||
export let node: Node;
|
export let node: Node;
|
||||||
export let inView = true;
|
export let inView = true;
|
||||||
@ -18,7 +17,10 @@
|
|||||||
|
|
||||||
let ref: HTMLDivElement;
|
let ref: HTMLDivElement;
|
||||||
|
|
||||||
$: if (node) {
|
$: if (node && ref) {
|
||||||
|
node.tmp = node.tmp || {};
|
||||||
|
node.tmp.ref = ref;
|
||||||
|
updateNodePosition(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
@ -103,7 +103,7 @@ export class GraphManager {
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.status.set("idle");
|
this.status.set("idle");
|
||||||
this.history.save();
|
this.save();
|
||||||
}, 100)
|
}, 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ export class GraphManager {
|
|||||||
nodes.delete(node.id);
|
nodes.delete(node.id);
|
||||||
return nodes;
|
return nodes;
|
||||||
});
|
});
|
||||||
this.history.save();
|
this.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
createEdge(from: Node, fromSocket: number, to: Node, toSocket: string) {
|
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]];
|
return [...edges.filter(e => e[2].id !== to.id || e[3] !== toSocket), [from, fromSocket, to, toSocket]];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
save() {
|
||||||
this.history.save();
|
this.history.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +264,7 @@ export class GraphManager {
|
|||||||
this.edges.update((edges) => {
|
this.edges.update((edges) => {
|
||||||
return edges.filter((e) => e[0].id !== id0 || e[1] !== sid0 || e[2].id !== id2 || e[3] !== sid2);
|
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) {
|
getEdgesToNode(node: Node) {
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
import { Canvas } from "@threlte/core";
|
import { Canvas } from "@threlte/core";
|
||||||
import { GraphManager } from "$lib/graph-manager";
|
import { GraphManager } from "$lib/graph-manager";
|
||||||
import Graph from "$lib/components/graph/Graph.svelte";
|
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 { MemoryRuntimeExecutor } from "$lib/runtime-executor";
|
||||||
import { MemoryNodeRegistry } from "$lib/node-registry";
|
import { MemoryNodeRegistry } from "$lib/node-registry";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user