This commit is contained in:
2024-12-19 18:28:17 +01:00
parent 53f400a4f6
commit 33d5ed14dd
16 changed files with 232 additions and 240 deletions

View File

@@ -1,6 +1,6 @@
import type { Edge, Graph, Node, NodeInput, NodeRegistry, Socket, } from "@nodes/types";
import { fastHashString } from "@nodes/utils";
import { get, writable, type Writable } from "svelte/store";
import { writable, type Writable } from "svelte/store";
import EventEmitter from "./helpers/EventEmitter.js";
import { createLogger } from "./helpers/index.js";
import throttle from "./helpers/throttle.js";
@@ -42,7 +42,6 @@ export class GraphManager extends EventEmitter<{ "save": Graph, "result": any, "
history: HistoryManager = new HistoryManager();
execute = throttle(() => {
console.log("Props", get(this.nodes).values().find(n => n.type === "max/plantarium/gravity")?.props);
if (this.loaded === false) return;
this.emit("result", this.serialize());
}, 10);

View File

@@ -48,7 +48,7 @@
$effect(() => {
if (graphState.activeNodeId !== -1) {
activeNode = manager.getNode(graphState.activeNodeId);
} else {
} else if (activeNode) {
activeNode = undefined;
}
});
@@ -64,7 +64,7 @@
});
manager.on("settings", (_settings) => {
settingTypes = _settings.types;
settingTypes = { ...settingTypes, ..._settings.types };
settings = _settings.values;
});

View File

@@ -31,7 +31,7 @@
}
let value = $state(getDefaultValue());
$inspect({ nodeId: node.type, id, value });
$effect(() => {
if (value !== undefined && node?.props?.[id] !== value) {
node.props = { ...node.props, [id]: value };