chore: update
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 3m50s

This commit is contained in:
Max Richter
2025-12-02 17:27:23 +01:00
parent a1c926c3cf
commit ef479d0557
5 changed files with 95 additions and 83 deletions

View File

@@ -4,6 +4,12 @@
import type { Node, NodeType } from "@nodarium/types";
import { getGraphManager, getGraphState } from "../graph/state.svelte";
type Props = {
onnode: (n: Node) => void;
};
const { onnode }: Props = $props();
const graph = getGraphManager();
const graphState = getGraphState();
@@ -35,24 +41,12 @@
function handleNodeCreation(nodeType: Node["type"]) {
if (!graphState.addMenuPosition) return;
const newNode = graph.createNode({
onnode?.({
id: -1,
type: nodeType,
position: graphState.addMenuPosition,
position: [...graphState.addMenuPosition],
props: {},
});
const edgeInputSocket = graphState.activeSocket;
if (edgeInputSocket && newNode) {
if (typeof edgeInputSocket.index === "number") {
graph.smartConnect(edgeInputSocket.node, newNode);
} else {
graph.smartConnect(newNode, edgeInputSocket.node);
}
}
graphState.activeSocket = null;
graphState.addMenuPosition = null;
}
function handleKeyDown(event: KeyboardEvent) {