diff --git a/samples/calc-02/index.js b/samples/calc-02/index.js index 89de0db..8001346 100644 --- a/samples/calc-02/index.js +++ b/samples/calc-02/index.js @@ -53,28 +53,28 @@ const keypadKeys = [ ]; const functionKeys = [ - { label: 'x²', action: 'sqr', className: 'key-default' }, - { label: 'yˣ', action: 'pow', className: 'key-default' }, - { label: '1/x', action: 'recip', className: 'key-default' }, + { label: 'x²', action: 'sqr', className: 'key-default', title: 's' }, + { label: '√x', action: 'sqrt', className: 'key-default', title: 'r' }, + { label: '1/x', action: 'recip', className: 'key-default', title: 'v' }, { label: '%', action: 'mod', className: 'key-default' }, - { label: '√x', action: 'sqrt', className: 'key-default' }, - { label: 'y√x', action: 'root', className: 'key-default' }, - { label: '10ˣ', action: 'pow10', className: 'key-default' }, + { label: 'yˣ', action: 'pow', className: 'key-default', title: 'S' }, + { label: 'y√x', action: 'root', className: 'key-default', title: 'R' }, + { label: '10ˣ', action: 'pow10', className: 'key-default', title: 'u' }, { label: '', spacer: true }, - { label: 'log', action: 'log', className: 'key-default' }, - { label: 'ln', action: 'ln', className: 'key-default' }, - { label: 'eˣ', action: 'exp', className: 'key-default' }, + { label: 'log', action: 'log', className: 'key-default', title: 'l / L' }, + { label: 'ln', action: 'ln', className: 'key-default', title: 'n / N' }, + { label: 'eˣ', action: 'exp', className: 'key-default', title: 'e / E' }, { label: '', spacer: true }, ]; const trigoKeys = [ - { label: 'sin', action: 'sin', className: 'key-default' }, - { label: 'cos', action: 'cos', className: 'key-default' }, - { label: 'tan', action: 'tan', className: 'key-default' }, + { label: 'sin', action: 'sin', className: 'key-default', title: 'i' }, + { label: 'cos', action: 'cos', className: 'key-default', title: 'o' }, + { label: 'tan', action: 'tan', className: 'key-default', title: 'a' }, { label: '', spacer: true }, - { label: 'asin', action: 'asin', className: 'key-default' }, - { label: 'acos', action: 'acos', className: 'key-default' }, - { label: 'atan', action: 'atan', className: 'key-default' }, + { label: 'asin', action: 'asin', className: 'key-default', title: 'I' }, + { label: 'acos', action: 'acos', className: 'key-default', title: 'O' }, + { label: 'atan', action: 'atan', className: 'key-default', title: 'A' }, { label: '', spacer: true }, ]; @@ -280,7 +280,7 @@ function execute(name) { } } -function createKeyButton({ label, input, action, spacer, className }) { +function createKeyButton({ label, input, action, spacer, className, title }) { if (spacer) { const div = document.createElement('div'); return div; @@ -289,6 +289,7 @@ function createKeyButton({ label, input, action, spacer, className }) { button.type = 'button'; button.textContent = label; button.className = className; + if (title) button.title = title; button.addEventListener('click', () => { if (input) { inputToX(input); @@ -340,8 +341,8 @@ function handleKeyboard(event) { S: 'pow', r: 'sqrt', R: 'root', - v: 'recip', - u: 'pow10', + x: 'recip', + d: 'pow10', l: 'log', L: 'log', n: 'ln', diff --git a/samples/calc-02/visual-portrait.md b/samples/calc-02/visual-portrait.md index 0c9e345..6fe8abc 100644 --- a/samples/calc-02/visual-portrait.md +++ b/samples/calc-02/visual-portrait.md @@ -24,11 +24,11 @@ ``` ┌──────────── Keypad ─────────────┐ -| +/- | Clear | Esc | backspace | -| 7 | 8 | 9 | / | -| 4 | 5 | 6 | * | -| 1 | 2 | 3 | - | -| 0 | . | Enter | + | +| Clear | Backspace | Esc | Enter | +| 7 | 8 | 9 | / | +| 4 | 5 | 6 | * | +| 1 | 2 | 3 | - | +| 0 | . | +/- | + | └─────────────────────────────────┘ ``` @@ -36,9 +36,9 @@ ``` ┌──────────── Functions ──────────┐ -| x^2 | y^x | 1/x | % | -| √x | y√x | 10^x | | -| log | ln | | | +| x^2 | √x | 1/x | % | +| y^x | y√x | 10^x | | +| log | ln | e^x | | └─────────────────────────────────┘ ```