docs: update calc-02 shortcut reference and key mappings
This commit is contained in:
+1
-1
@@ -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`
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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'];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user