{
+ if (event.key === "Enter") {
+ if (position) {
+ graph.createNode({ type: node.id, position });
+ position = null;
+ }
+ }
+ }}
+ on:mousedown={() => {
+ if (position) {
+ graph.createNode({ type: node.id, position });
+ position = null;
+ }
+ }}
+ on:focus={() => {
+ activeNodeId = node.id;
+ }}
+ class:selected={node.id === activeNodeId}
+ on:mouseover={() => {
+ activeNodeId = node.id;
+ }}
+ >
+ {node.id}
+
+ {/each}
+