refactor: move view logic inside graph.svelte

This commit is contained in:
2024-03-12 18:47:50 +01:00
parent af24b5cffe
commit 9241700ada
16 changed files with 465 additions and 384 deletions

View File

@@ -1,5 +1,6 @@
<script lang="ts">
import type { Node } from "$lib/types";
import { getContext } from "svelte";
import { getGraphManager, getGraphState } from "./graph/context";
export let node: Node;
@@ -34,16 +35,15 @@
Z`.replace(/\s+/g, " ");
}
const setDownSocket = getContext("setDownSocket");
function handleMouseDown(event: MouseEvent) {
event.stopPropagation();
event.preventDefault();
state.setMouseDown({
x: node.position.x + 5,
y: node.position.y + 0.625,
setDownSocket({
node,
type: node.tmp?.type?.outputs?.[0] || "",
index: 0,
isInput: false,
position: [node.position.x + 5, node.position.y + 0.625],
});
}
</script>