docs: update calc-02 shortcut reference and key mappings
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
# State
|
# State
|
||||||
- Core engine: `src/rpn-calculator.js`
|
- 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
|
- 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
|
- 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`
|
- 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`
|
- `Escape`
|
||||||
- `ArrowUp`, `ArrowDown`, `ArrowRight`
|
- `ArrowUp`, `ArrowDown`, `ArrowRight`
|
||||||
- `+`, `-`, `*`, `/`, `%`, `^`
|
- `+`, `-`, `*`, `/`, `%`, `^`
|
||||||
- `q`, `n`, `r`, `i`, `g`, `l`, `s`, `c`, `S`, `C`
|
- `s`, `S`, `r`, `R`, `v`, `u`
|
||||||
- `x`, `y`, `z`, `t`
|
- `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.
|
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.
|
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
|
## Exports
|
||||||
|
|
||||||
`RpnCalculator` is exposed in both environments:
|
`RpnCalculator` is exposed in both environments:
|
||||||
|
|||||||
@@ -336,6 +336,24 @@ function handleKeyboard(event) {
|
|||||||
'/': 'div',
|
'/': 'div',
|
||||||
'%': 'mod',
|
'%': 'mod',
|
||||||
'^': 'pow',
|
'^': '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') {
|
if (key === 'ArrowLeft') {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -470,7 +488,7 @@ const constantLabels = {
|
|||||||
e: 'e',
|
e: 'e',
|
||||||
phi: 'φ',
|
phi: 'φ',
|
||||||
g: 'g',
|
g: 'g',
|
||||||
c: 'c',
|
c: 'C',
|
||||||
};
|
};
|
||||||
const constantOrder = ['pi', 'e', 'phi', 'g', 'c'];
|
const constantOrder = ['pi', 'e', 'phi', 'g', 'c'];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user