diff --git a/.memory/project.md b/.memory/project.md index c06bd9d..f1549c2 100644 --- a/.memory/project.md +++ b/.memory/project.md @@ -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` diff --git a/README.md b/README.md index 7cedfbd..146ecf8 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/samples/calc-02/index.js b/samples/calc-02/index.js index 5f69357..89de0db 100644 --- a/samples/calc-02/index.js +++ b/samples/calc-02/index.js @@ -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'];