refactor: split ui/runtime/serialized node types

Closes #6
This commit is contained in:
Max Richter
2025-12-03 19:18:56 +01:00
parent 1126cf8f9f
commit 7ae1fae3b9
24 changed files with 306 additions and 343 deletions

View File

@@ -1,6 +1,5 @@
<script lang="ts">
import type { Node } from "@nodarium/types";
import { onMount } from "svelte";
import type { NodeInstance } from "@nodarium/types";
import { getGraphState } from "../graph/state.svelte";
import { T } from "@threlte/core";
import { type Mesh } from "three";
@@ -13,7 +12,7 @@
const graphState = getGraphState();
type Props = {
node: Node;
node: NodeInstance;
inView: boolean;
z: number;
};
@@ -35,9 +34,8 @@
const height = graphState.getNodeHeight(node.type);
$effect(() => {
if (!node.tmp) node.tmp = {};
if (meshRef && !node.tmp?.mesh) {
node.tmp.mesh = meshRef;
if (meshRef && !node.state?.mesh) {
node.state.mesh = meshRef;
graphState.updateNodePosition(node);
}
});