feat: add keyboard shortcuts for calculator commands

This commit is contained in:
2026-04-24 22:08:24 +02:00
parent dbe046a194
commit 277c4689d5
+13 -1
View File
@@ -213,7 +213,7 @@
<input id="input" class="hidden-input" type="text" autocomplete="off" aria-hidden="true" tabindex="-1">
<div class="input-row">
<div class="hint">Keyboard works globally: digits, numpad, Enter, Backspace, Delete, →, +, -, *, /, %, ^</div>
<div class="hint">Keyboard works globally: digits, numpad, Enter, Backspace, Delete, →, +, -, *, /, %, ^, q, n, r, i, g, l, s, c, t, S, C, T</div>
<select id="angleMode">
<option value="deg">Degrees</option>
<option value="rad">Radians</option>
@@ -412,6 +412,18 @@
'/': { type: 'command', value: 'div' },
'%': { type: 'command', value: 'mod' },
'^': { type: 'command', value: 'pow' },
q: { type: 'command', value: 'sqr' },
n: { type: 'command', value: 'neg' },
r: { type: 'command', value: 'sqrt' },
i: { type: 'command', value: 'recip' },
g: { type: 'command', value: 'log' },
l: { type: 'command', value: 'ln' },
s: { type: 'command', value: 'sin' },
c: { type: 'command', value: 'cos' },
t: { type: 'command', value: 'tan' },
S: { type: 'command', value: 'asin' },
C: { type: 'command', value: 'acos' },
T: { type: 'command', value: 'atan' },
};
return keyMap[event.key] || null;