feat: add keyboard shortcuts for calculator commands
This commit is contained in:
+13
-1
@@ -213,7 +213,7 @@
|
|||||||
<input id="input" class="hidden-input" type="text" autocomplete="off" aria-hidden="true" tabindex="-1">
|
<input id="input" class="hidden-input" type="text" autocomplete="off" aria-hidden="true" tabindex="-1">
|
||||||
|
|
||||||
<div class="input-row">
|
<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">
|
<select id="angleMode">
|
||||||
<option value="deg">Degrees</option>
|
<option value="deg">Degrees</option>
|
||||||
<option value="rad">Radians</option>
|
<option value="rad">Radians</option>
|
||||||
@@ -412,6 +412,18 @@
|
|||||||
'/': { type: 'command', value: 'div' },
|
'/': { type: 'command', value: 'div' },
|
||||||
'%': { type: 'command', value: 'mod' },
|
'%': { type: 'command', value: 'mod' },
|
||||||
'^': { type: 'command', value: 'pow' },
|
'^': { 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;
|
return keyMap[event.key] || null;
|
||||||
|
|||||||
Reference in New Issue
Block a user