From 18c4c7e82e309e868e4e1e47460c5b3a0600847e Mon Sep 17 00:00:00 2001
From: Sam Nystrom <sam@samnystrom.dev>
Date: Thu, 7 Mar 2024 07:07:15 +0000
Subject: Switch f64 to f32

---
 src/NodeEditor.tsx | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

(limited to 'src/NodeEditor.tsx')

diff --git a/src/NodeEditor.tsx b/src/NodeEditor.tsx
index 83d81bd..0340a49 100644
--- a/src/NodeEditor.tsx
+++ b/src/NodeEditor.tsx
@@ -1,4 +1,4 @@
-import { useMemo, useRef } from 'preact/hooks';
+import { useEffect, useMemo, useRef } from 'preact/hooks';
 import { signal, computed, batch, useSignal, useComputed, Signal } from '@preact/signals';
 import { nodeRegistry } from './nodes';
 import { SocketHandlers, SocketHandler, NodeInfo } from './node.tsx';
@@ -188,6 +188,17 @@ export const NodeEditor = () => {
 		onInMouseUp,
 	};
 
+	const onKeyDown = (event: KeyboardEvent) => {
+		if (event.code === 'KeyX') {
+			alert('X');
+		}
+	};
+
+	useEffect(() => {
+		document.addEventListener('keydown', onKeyDown);
+		return () => document.removeEventListener('keydown', onKeyDown);
+	}, []);
+
 	const onBgMouseDown = () => {
 		const onMouseMove = (event: MouseEvent) => batch(() => {
 			offsetX.value += event.movementX;
-- 
cgit v1.2.3

