(e: KeyboardEvent)
| 51 | // Keyboard calibration (handy when a keyboard is plugged into the Pi). |
| 52 | useEffect(() => { |
| 53 | const onKey = (e: KeyboardEvent) => { |
| 54 | const c = configRef.current; |
| 55 | switch (e.key) { |
| 56 | case "r": |
| 57 | conn.patchConfig({ rotationDeg: (c.rotationDeg + 5) % 360 }); |
| 58 | break; |
| 59 | case "R": |
| 60 | conn.patchConfig({ rotationDeg: (c.rotationDeg - 5 + 360) % 360 }); |
| 61 | break; |
| 62 | case "m": |
| 63 | conn.patchConfig({ mirrorX: !c.mirrorX }); |
| 64 | break; |
| 65 | case "M": |
| 66 | conn.patchConfig({ mirrorY: !c.mirrorY }); |
| 67 | break; |
| 68 | case "t": { |
| 69 | const next = THEMES[(THEMES.indexOf(c.theme) + 1) % THEMES.length]; |
| 70 | conn.patchConfig({ theme: next }); |
| 71 | break; |
| 72 | } |
| 73 | case "[": |
| 74 | conn.patchConfig({ radiusMiles: Math.max(0.5, c.radiusMiles - 0.5) }); |
| 75 | break; |
| 76 | case "]": |
| 77 | conn.patchConfig({ radiusMiles: c.radiusMiles + 0.5 }); |
| 78 | break; |
| 79 | case "h": |
| 80 | conn.patchConfig({ showHud: !c.showHud }); |
| 81 | break; |
| 82 | case "f": |
| 83 | ambientToggleRef.current(); |
| 84 | break; |
| 85 | } |
| 86 | }; |
| 87 | window.addEventListener("keydown", onKey); |
| 88 | return () => window.removeEventListener("keydown", onKey); |
| 89 | }, [conn]); |
nothing calls this directly
no test coverage detected