docs: update calc-02 shortcut reference and key mappings

This commit is contained in:
2026-05-17 00:14:24 +02:00
parent b710d5f0eb
commit 16b567731f
3 changed files with 25 additions and 4 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
# State
- Core engine: `src/rpn-calculator.js`
- Reference demo: `samples/calc-02/` (portrait-first HP48GX layout, compact mode/constants popups; Const button comes before Mode in the display row)
- Reference demo: `samples/calc-02/` (portrait-first HP48GX layout; calc-02 keyboard shortcuts are the reference; compact mode/constants popups; Const button comes before Mode in the display row)
- Important UI behavior: mode button shows the current angle mode; keyboard focus stays on the hidden input on desktop; clipboard paste is supported
- Note: keep scrolling behavior in mind for the calc-02 demo when changing the stack/UI layout
- Public API: `push`, `pop`, `clear`, `swap`, `remove`, `edit`, `isValidIndex`, `input`, `command`, `getOperationsByCategory`, `getConstants`, `listConstants`, `setConstant`, `removeConstant`, `hasConstant`
+5 -2
View File
@@ -275,12 +275,15 @@ The current demo supports:
- `Escape`
- `ArrowUp`, `ArrowDown`, `ArrowRight`
- `+`, `-`, `*`, `/`, `%`, `^`
- `q`, `n`, `r`, `i`, `g`, `l`, `s`, `c`, `S`, `C`
- `x`, `y`, `z`, `t`
- `s`, `S`, `r`, `R`, `v`, `u`
- `l`, `L`, `n`, `N`, `e`, `E`
- `i`, `o`, `a`, `I`, `O`, `A`
The demo also implements stack selection and stack-item move mode in its UI layer using the public calculator methods.
It keeps the calculator screen focused and updates the visible stack window as the selection moves.
Note: `calc-02` keyboard shortcuts are the reference for this project.
## Exports
`RpnCalculator` is exposed in both environments:
+19 -1
View File
@@ -336,6 +336,24 @@ function handleKeyboard(event) {
'/': 'div',
'%': 'mod',
'^': 'pow',
s: 'sqr',
S: 'pow',
r: 'sqrt',
R: 'root',
v: 'recip',
u: 'pow10',
l: 'log',
L: 'log',
n: 'ln',
N: 'ln',
e: 'exp',
E: 'exp',
i: 'sin',
o: 'cos',
a: 'tan',
I: 'asin',
O: 'acos',
A: 'atan',
};
if (key === 'ArrowLeft') {
event.preventDefault();
@@ -470,7 +488,7 @@ const constantLabels = {
e: 'e',
phi: 'φ',
g: 'g',
c: 'c',
c: 'C',
};
const constantOrder = ['pi', 'e', 'phi', 'g', 'c'];